Files
livewire-material/resources/views/showcase/sections/chips.blade.php
T
Andreas Reinhold / reiniandClaude Opus 5 79ca9a28b4 Stop drawing each section's title twice on its page
Plan step 38 review: the frame's structural rule that kept a section's
own <h2> for screen readers (Tailwind's [&>section>h2]:sr-only before,
a showcase.css rule during the rewrite) was removed as dead weight
once every section had a real heading, so each page drew its title
twice, the <h1> and an identical headline under it. The <h2>s are
md-visually-hidden again, the frame's comment says why, and the
section page test asserts it. The Layout section's description said
"window size classes"; M3's term is breakpoints.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
2026-09-15 06:10:01 +02:00

81 lines
4.9 KiB
PHP

@php
$examples = [
'Assist chips' => <<<'BLADE'
<x-livewire-material::row gap="space100" wrap align="center" x-data>
<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 />
</x-livewire-material::row>
BLADE,
'Filter chips' => <<<'BLADE'
<x-livewire-material::stack gap="space300" x-data="{ kinds: ['photos'] }">
<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>
</x-livewire-material::stack>
BLADE,
'Input chips' => <<<'BLADE'
<x-livewire-material::stack gap="space300" x-data="{ recipients: ['anna@example.com', 'ben@example.com', 'chiara@example.com'] }">
<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>
</x-livewire-material::stack>
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'
{{-- M3 asks an overflowing chip row for a visible affordance: the edge it can still scroll towards fades, and on a mouse a button sits over it. --}}
<div data-md-showcase-chip-scroll>
<x-chip-set label="Sort and filter" hint="Drag, or use the arrow keys" 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
<x-livewire-material::stack as="section" id="chips" gap="space300">
<h2 class="md-visually-hidden">Chips</h2>
<p class="md-type-body-md md-ink-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
</x-livewire-material::stack>