{{-- A set of M3 chips: a row that wraps, 8px apart, named for screen readers as a group. `label` is shown above the row and names the group; without it, pass `aria-label`. `hint` sits under it, and a validation message for `error-field` (the property the chips bind, and its items: `kinds` and `kinds.*`) replaces the hint. `scroll` keeps the chips on one line that scrolls sideways, as M3 lays chips out on a narrow screen: the edge it can still scroll towards fades (resources/js/chips.js), and a chip reached with Tab scrolls clear of the fade. Removing a focused input chip moves focus within the set. The set is one tab stop and the arrow keys move between the chips inside it, with Home and End at the ends — M3's chip keyboard table. Backspace and Delete still remove a focused input chip. --}} @props([ 'label' => null, 'hint' => null, 'errorField' => null, 'scroll' => false, ]) @php $key = \Illuminate\Support\Str::lower(\Illuminate\Support\Str::random(10)); $messages = filled($errorField) && isset($errors) ? array_values(array_unique(\Illuminate\Support\Arr::flatten([$errors->get($errorField), $errors->get($errorField.'.*')]))) : []; $describedBy = $messages !== [] || filled($hint) ? "material-chip-set-{$key}-hint" : null; @endphp
class('min-w-0') }} > @if (filled($label))

{{ $label }}

@endif @if ($scroll)
{{ $slot }}
@else
{{ $slot }}
@endif @if ($messages !== [])
@foreach ($messages as $message)

{{ $message }}

@endforeach
@elseif (filled($hint))

{{ $hint }}

@endif