Add chips, choices and search
tests / lint (push) Successful in 1m4s
tests / feature (8.4) (push) Successful in 1m8s
tests / feature (8.5) (push) Successful in 1m8s
tests / browser (chrome, chromium) (push) Successful in 3m6s
tests / browser (firefox, firefox) (push) Successful in 3m45s
tests / browser (safari, webkit) (push) Successful in 5m0s

M3's assist, filter, input and suggestion chips with chip sets; choices
as filter chips or a searchable combobox whose list is an anchored
popover; and the search bar that opens into a docked or full-screen
search view.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
Andreas Reinhold / reini
2026-09-13 08:07:59 +02:00
co-authored by Claude Opus 5
parent 7f92f1cb29
commit 0fee2a0952
21 changed files with 2061 additions and 2 deletions
@@ -0,0 +1,79 @@
@php
$examples = [
'Assist chips' => <<<'BLADE'
<div x-data class="flex flex-wrap items-center gap-2">
<x-chip label="Add to calendar" icon="event" x-on:click="materialToast('Added to your calendar')" />
<x-chip label="Directions" icon="directions" link="#chips" />
<x-chip label="Share" icon="share" elevated tooltip="Share this file" />
<x-chip label="Material 3 guidelines" icon-right="open_in_new" link="https://m3.material.io/components/chips" external />
<x-chip label="Unavailable" icon="block" disabled />
<x-chip label="Unavailable" icon="block" elevated disabled />
</div>
BLADE,
'Filter chips' => <<<'BLADE'
<div x-data="{ kinds: ['photos'] }" class="w-full space-y-6">
<x-chip-set label="File types" hint="Show only these kinds of file">
<x-chip type="filter" label="Photos" value="photos" x-model="kinds" />
<x-chip type="filter" label="Documents" value="documents" x-model="kinds" />
<x-chip type="filter" label="Archives" value="archives" x-model="kinds" />
<x-chip type="filter" label="Video" value="video" x-model="kinds" disabled />
</x-chip-set>
<x-chip-set label="Elevated, with icons">
<x-chip type="filter" label="Starred" icon="star" name="starred" :selected="true" elevated />
<x-chip type="filter" label="Shared with me" icon="group" name="shared" elevated />
<x-chip type="filter" label="Expiring" name="expiring" icon-right="arrow_drop_down" />
<x-chip type="filter" label="Archived" name="archived" :selected="true" disabled />
</x-chip-set>
</div>
BLADE,
'Input chips' => <<<'BLADE'
<div x-data="{ recipients: ['anna@example.com', 'ben@example.com', 'chiara@example.com'] }" class="w-full space-y-6">
<x-chip-set label="Recipients" hint="Backspace or Delete removes the focused chip">
<template x-for="recipient in recipients" :key="recipient">
<x-chip type="input" icon="mail" removable remove="recipients = recipients.filter((other) => other !== recipient)"><span x-text="recipient"></span></x-chip>
</template>
</x-chip-set>
<x-chip-set label="People">
<x-chip type="input" label="Anna Müller" avatar="AM" removable />
<x-chip type="input" label="Ben Keller" avatar="BK" :selected="true" removable />
<x-chip type="input" label="contract.pdf" icon="picture_as_pdf" x-on:click="materialToast('contract.pdf')" />
<x-chip type="input" label="Chiara Rossi" avatar="CR" removable disabled />
</x-chip-set>
</div>
BLADE,
'Suggestion chips' => <<<'BLADE'
<x-chip-set label="Suggested replies">
<x-chip type="suggestion" label="Sounds good" />
<x-chip type="suggestion" label="Can we talk tomorrow?" />
<x-chip type="suggestion" label="Send the files" icon="attach_file" elevated />
<x-chip type="suggestion" label="Not now" disabled />
</x-chip-set>
BLADE,
'A set that scrolls' => <<<'BLADE'
<div class="w-full max-w-sm">
<x-chip-set label="Sort and filter" scroll>
<x-chip type="filter" label="Newest" name="sort[]" value="newest" :selected="true" />
<x-chip type="filter" label="Largest" name="sort[]" value="largest" />
<x-chip type="filter" label="Expiring soon" name="sort[]" value="expiring" />
<x-chip type="filter" label="Password protected" name="sort[]" value="protected" />
<x-chip type="filter" label="Downloaded" name="sort[]" value="downloaded" />
<x-chip type="filter" label="Never opened" name="sort[]" value="unopened" />
</x-chip-set>
</div>
BLADE,
];
@endphp
<section id="chips" class="scroll-mt-24 space-y-6">
<h2 class="type-headline-md">Chips</h2>
<p class="max-w-3xl type-body-md text-on-surface-variant">
<code>&lt;x-chip&gt;</code> assist, filter, input and suggestion and <code>&lt;x-chip-set&gt;</code>.
</p>
@foreach ($examples as $title => $code)
<x-showcase::example :$title :$code />
@endforeach
</section>