{{-- M3's search: a search bar that opens into a search view with the results. Bind the input like any other (`wire:model.live.debounce.300ms="query"`) and render the results in the slot, from a Livewire property or computed property that follows the query; `empty` is shown instead when the slot renders nothing (say, "No shares match"). Results are usually ``s with a `link`, or buttons: choosing one closes the view. Docked under the bar from `sm`, full screen below it with a back arrow (resources/css/ components/search.css); `docked` keeps it docked at every width. `placeholder` ("Search"), `label` (the input's name when it differs from the placeholder), leading `icon` (`search`), and a `trailing` slot for an avatar or icon buttons in the bar. Every other attribute reaches the ``. --}} @props([ 'placeholder' => null, 'label' => null, 'icon' => 'search', 'docked' => false, ]) @php $model = $attributes->wire('model')->value() ?: null; $placeholder ??= __('Search'); $id = $attributes->get('id') ?? 'material-search-'.substr(md5($model.'|'.$placeholder), 0, 10); @endphp
only(['class', 'wire:key'])->class(['relative']) }} >
except(['class', 'wire:key', 'id', 'placeholder', 'type']) }} x-ref="input" id="{{ $id }}" type="search" autocomplete="off" enterkeyhint="search" placeholder="{{ $placeholder }}" aria-label="{{ $label ?? $placeholder }}" aria-controls="{{ $id }}-view" aria-expanded="false" x-bind:aria-expanded="open.toString()" x-on:focus="focused()" x-on:click="show()" x-on:input="show()" x-on:keydown.arrow-down.prevent="show(); $nextTick(() => step(1))" data-search-input /> @isset($trailing) {{ $trailing }} @endisset
@if ($slot->hasActualContent())
{{ $slot }}
@elseif (isset($empty))

{{ $empty }}

@endif