Selects

原生 select — 颜色 × 外观、尺寸、选项组、多选、浮动标签

最简

<x-select color="neutral" placeholder="neutral"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select color="primary" placeholder="primary"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select color="info" placeholder="info"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select color="success" placeholder="success"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select color="warning" placeholder="warning"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select color="error" placeholder="error"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'neutral', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b7274352" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                neutral
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'primary', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72743bb" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                primary
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-primary/10 text-primary border-primary/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-primary/10 text-primary ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-primary" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'info', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b7274417" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                info
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-info focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-info/10 text-info border-info/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-info/10 text-info ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-info" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'success', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b7274471" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                success
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-success focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-success/10 text-success border-success/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-success/10 text-success ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-success" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'warning', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72744cb" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                warning
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-warning focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-warning/10 text-warning border-warning/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-warning/10 text-warning ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-warning" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'error', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b727452c" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                error
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-error/10 text-error border-error/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-error/10 text-error ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-error" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

appearance=soft

<x-select appearance="soft" color="neutral" placeholder="neutral"><option value="a">Apple</option></x-select>
<x-select appearance="soft" color="primary" placeholder="primary"><option value="a">Apple</option></x-select>
<x-select appearance="soft" color="info" placeholder="info"><option value="a">Apple</option></x-select>
<x-select appearance="soft" color="success" placeholder="success"><option value="a">Apple</option></x-select>
<x-select appearance="soft" color="warning" placeholder="warning"><option value="a">Apple</option></x-select>
<x-select appearance="soft" color="error" placeholder="error"><option value="a">Apple</option></x-select>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'neutral', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72eb894" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                neutral
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'primary', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72eb90c" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                primary
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-primary/10 text-primary border-primary/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-primary/10 text-primary ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-primary" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'info', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72eb974" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                info
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-info/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-info/10 text-info border-info/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-info/10 text-info ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-info" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'success', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72eb9dd" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                success
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-success/10 text-success border-success/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-success/10 text-success ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-success" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'warning', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72eba43" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                warning
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-warning/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-warning/10 text-warning border-warning/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-warning/10 text-warning ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-warning" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'error', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b72ebaa7" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                error
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-error/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-error/10 text-error border-error/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-error/10 text-error ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-error" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

appearance=underline

<x-select appearance="underline" color="neutral" placeholder="neutral"><option value="a">Apple</option></x-select>
<x-select appearance="underline" color="primary" placeholder="primary"><option value="a">Apple</option></x-select>
<x-select appearance="underline" color="info" placeholder="info"><option value="a">Apple</option></x-select>
<x-select appearance="underline" color="success" placeholder="success"><option value="a">Apple</option></x-select>
<x-select appearance="underline" color="warning" placeholder="warning"><option value="a">Apple</option></x-select>
<x-select appearance="underline" color="error" placeholder="error"><option value="a">Apple</option></x-select>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'neutral', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b736af14" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                neutral
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'primary', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b736af88" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                primary
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-primary/10 text-primary border-primary/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-primary/10 text-primary ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-primary" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'info', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b736afec" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                info
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-info h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-info/10 text-info border-info/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-info/10 text-info ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-info" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'success', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b736b052" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                success
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-success h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-success/10 text-success border-success/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-success/10 text-success ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-success" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'warning', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b736b0b2" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                warning
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-warning h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-warning/10 text-warning border-warning/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-warning/10 text-warning ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-warning" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'error', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b736b113" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                error
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors bg-transparent border-b border-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-error/10 text-error border-error/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-error/10 text-error ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-error" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

appearance=ghost

<x-select appearance="ghost" color="neutral" placeholder="neutral"><option value="a">Apple</option></x-select>
<x-select appearance="ghost" color="primary" placeholder="primary"><option value="a">Apple</option></x-select>
<x-select appearance="ghost" color="info" placeholder="info"><option value="a">Apple</option></x-select>
<x-select appearance="ghost" color="success" placeholder="success"><option value="a">Apple</option></x-select>
<x-select appearance="ghost" color="warning" placeholder="warning"><option value="a">Apple</option></x-select>
<x-select appearance="ghost" color="error" placeholder="error"><option value="a">Apple</option></x-select>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'neutral', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b73df194" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                neutral
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'primary', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b73df20a" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                primary
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-primary/5 focus-within:bg-primary/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-primary/10 text-primary border-primary/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-primary/10 text-primary ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-primary" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'info', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b73df26d" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                info
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-info/5 focus-within:bg-info/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-info/10 text-info border-info/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-info/10 text-info ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-info" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'success', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b73df2c7" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                success
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-success/5 focus-within:bg-success/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-success/10 text-success border-success/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-success/10 text-success ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-success" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'warning', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b73df327" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                warning
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-warning/5 focus-within:bg-warning/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-warning/10 text-warning border-warning/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-warning/10 text-warning ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-warning" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'error', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b73df385" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                error
            </option>
<option value="a">
                Apple
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-error/5 focus-within:bg-error/10 h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-error/10 text-error border-error/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-error/10 text-error ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-error" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

size — sm / md / lg

<x-select size="sm" placeholder="size sm"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select size="md" placeholder="size md (default)"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<x-select size="lg" placeholder="size lg"><option value="a">Apple</option><option value="b">Banana</option></x-select>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'size sm', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b745ef89" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                size sm
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-sm)] text-base-content' : 'truncate text-[length:var(--text-field-sm)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-sm)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-sm)] px-[var(--px-input-sm)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-sm)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'size md (default)', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b745effe" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                size md (default)
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'size lg', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b745f061" class="sr-only" tabindex="-1" aria-hidden="true">
<option value="" disabled selected hidden="">
                size lg
            </option>
<option value="a">
                Apple
            </option>
<option value="b">
                Banana
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-lg)] text-base-content' : 'truncate text-[length:var(--text-field-lg)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-lg)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)] px-[var(--px-input-lg)] py-1.5 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-lg)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

label / hint / corner-hint / error

Submitted as an ISO country code

required

Please choose a language

optional
<x-select label="Country" name="country" placeholder="Please select" hint="Submitted as an ISO country code">
    <option value="jp">Japan</option>
    <option value="us">United States</option>
    <option value="uk">United Kingdom</option>
</x-select>
<x-select label="Plan" name="plan" required corner-hint="required" placeholder="Choose a plan">
    <option value="free">Free</option>
    <option value="pro">Pro</option>
    <option value="enterprise">Enterprise</option>
</x-select>
<x-select label="Language" name="lang" error="Please choose a language" placeholder="Not selected">
    <option value="ja">Japanese</option>
    <option value="en">English</option>
</x-select>
<x-select label="Priority" name="priority" corner-hint="optional" placeholder="Can be set later">
    <option value="low">Low</option>
    <option value="med">Medium</option>
    <option value="high">High</option>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="country_6a7e9b749cbd7" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Country</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Please select', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="country_6a7e9b749cbd7" class="sr-only" tabindex="-1" aria-hidden="true" name="country">
<option value="" disabled selected hidden="">
                Please select
            </option>
<option value="jp">
                Japan
            </option>
<option value="us">
                United States
            </option>
<option value="uk">
                United Kingdom
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
<p class="mt-1.5 text-[length:var(--text-field-sm)] text-base-content/50">
        Submitted as an ISO country code
    </p>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="plan_6a7e9b749cc4e" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Plan <span class="text-error ml-0.5">*</span></label>
<span class="text-[length:var(--text-field-xs)] text-base-content/50">required</span>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Choose a plan', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="plan_6a7e9b749cc4e" class="sr-only" tabindex="-1" aria-hidden="true" name="plan" required="">
<option value="" disabled selected hidden="">
                Choose a plan
            </option>
<option value="free">
                Free
            </option>
<option value="pro">
                Pro
            </option>
<option value="enterprise">
                Enterprise
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="lang_6a7e9b749ccb8" class="block text-[length:var(--text-field-sm)] font-medium text-error">Language</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Not selected', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="lang_6a7e9b749ccb8" class="sr-only" tabindex="-1" aria-hidden="true" name="lang">
<option value="" disabled selected hidden="">
                Not selected
            </option>
<option value="ja">
                Japanese
            </option>
<option value="en">
                English
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-error/10 text-error border-error/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-error/10 text-error ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-error" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
<p class="mt-1.5 text-[length:var(--text-field-sm)] text-error">
        Please choose a language
    </p>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="priority_6a7e9b749cd25" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Priority</label>
<span class="text-[length:var(--text-field-xs)] text-base-content/50">optional</span>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Can be set later', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="priority_6a7e9b749cd25" class="sr-only" tabindex="-1" aria-hidden="true" name="priority">
<option value="" disabled selected hidden="">
                Can be set later
            </option>
<option value="low">
                Low
            </option>
<option value="med">
                Medium
            </option>
<option value="high">
                High
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

optgroup

<x-select label="Font" name="font" placeholder="Select a font">
    <optgroup label="Sans-serif">
        <option value="inter">Inter</option>
        <option value="noto">Noto Sans JP</option>
    </optgroup>
    <optgroup label="Serif">
        <option value="playfair">Playfair Display</option>
        <option value="lora">Lora</option>
    </optgroup>
    <optgroup label="Mono">
        <option value="jetbrains">JetBrains Mono</option>
        <option value="space">Space Mono</option>
    </optgroup>
</x-select>
<x-select label="Timezone" name="tz" appearance="soft" placeholder="Select a timezone">
    <optgroup label="Asia">
        <option value="tokyo">Asia/Tokyo</option>
        <option value="seoul">Asia/Seoul</option>
        <option value="shanghai">Asia/Shanghai</option>
    </optgroup>
    <optgroup label="Americas">
        <option value="ny">America/New_York</option>
        <option value="la">America/Los_Angeles</option>
    </optgroup>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="font_6a7e9b74f1d88" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Font</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Select a font', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="font_6a7e9b74f1d88" class="sr-only" tabindex="-1" aria-hidden="true" name="font">
<option value="" disabled selected hidden="">
                Select a font
            </option>
<optgroup label="Sans-serif">
<option value="inter">
                    Inter
                </option>
<option value="noto">
                    Noto Sans JP
                </option>
</optgroup>
<optgroup label="Serif">
<option value="playfair">
                    Playfair Display
                </option>
<option value="lora">
                    Lora
                </option>
</optgroup>
<optgroup label="Mono">
<option value="jetbrains">
                    JetBrains Mono
                </option>
<option value="space">
                    Space Mono
                </option>
</optgroup>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="tz_6a7e9b74f1e06" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Timezone</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Select a timezone', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="tz_6a7e9b74f1e06" class="sr-only" tabindex="-1" aria-hidden="true" name="tz">
<option value="" disabled selected hidden="">
                Select a timezone
            </option>
<optgroup label="Asia">
<option value="tokyo">
                    Asia/Tokyo
                </option>
<option value="seoul">
                    Asia/Seoul
                </option>
<option value="shanghai">
                    Asia/Shanghai
                </option>
</optgroup>
<optgroup label="Americas">
<option value="ny">
                    America/New_York
                </option>
<option value="la">
                    America/Los_Angeles
                </option>
</optgroup>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

multiple / list (rows)

Cmd/Ctrl-click to pick several

rows=5 renders it as a list box

<x-select label="Multi-select" name="tags" multiple rows="5" hint="Cmd/Ctrl-click to pick several">
    <option value="apple">Apple</option>
    <option value="banana">Banana</option>
    <option value="cherry">Cherry</option>
    <option value="durian">Durian</option>
    <option value="elderberry">Elderberry</option>
</x-select>
<x-select label="Single list" name="single_list" rows="5" hint="rows=5 renders it as a list box">
    <option value="apple">Apple</option>
    <option value="banana">Banana</option>
    <option value="cherry">Cherry</option>
    <option value="durian">Durian</option>
    <option value="elderberry">Elderberry</option>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="tags_6a7e9b752b5fa" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Multi-select</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: true, placeholder: '请选择', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="tags_6a7e9b752b5fa" class="sr-only" tabindex="-1" aria-hidden="true" name="tags[]" multiple>
<option value="apple">
                Apple
            </option>
<option value="banana">
                Banana
            </option>
<option value="cherry">
                Cherry
            </option>
<option value="durian">
                Durian
            </option>
<option value="elderberry">
                Elderberry
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
<p class="mt-1.5 text-[length:var(--text-field-sm)] text-base-content/50">
        Cmd/Ctrl-click to pick several
    </p>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="single_list_6a7e9b752b677" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Single list</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: '请选择', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="single_list_6a7e9b752b677" class="sr-only" tabindex="-1" aria-hidden="true" name="single_list">
<option value="apple">
                Apple
            </option>
<option value="banana">
                Banana
            </option>
<option value="cherry">
                Cherry
            </option>
<option value="durian">
                Durian
            </option>
<option value="elderberry">
                Elderberry
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
<p class="mt-1.5 text-[length:var(--text-field-sm)] text-base-content/50">
        rows=5 renders it as a list box
    </p>
</div>

floating label

<x-select floating size="sm" label="Country" name="floating_country_sm" placeholder="Choose">
    <option value="jp">Japan</option><option value="us">USA</option>
</x-select>
<x-select floating size="md" label="Plan" name="floating_plan_md" placeholder="Choose">
    <option value="free">Free</option><option value="pro">Pro</option>
</x-select>
<x-select floating size="lg" label="Language" name="floating_lang_lg" required placeholder="Choose">
    <option value="ja">Japanese</option><option value="en">English</option>
</x-select>
<div class="w-full">
<div class="relative flex items-stretch transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)]">
<label for="floating_country_sm_6a7e9b7556ef9" class="absolute left-[var(--px-input-sm)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Country</label>
<select id="floating_country_sm_6a7e9b7556ef9" name="floating_country_sm" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-sm)] pl-[var(--px-input-sm)] pr-9 pt-3.5 pb-0.5">
<option value="" disabled selected hidden="">
                Choose
            </option>
<option value="jp">
                Japan
            </option>
<option value="us">
                USA
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
</div>
<div class="w-full">
<div class="relative flex items-stretch transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)]">
<label for="floating_plan_md_6a7e9b7556f6c" class="absolute left-[var(--px-input-md)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Plan</label>
<select id="floating_plan_md_6a7e9b7556f6c" name="floating_plan_md" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-md)] pl-[var(--px-input-md)] pr-9 pt-4 pb-0.5">
<option value="" disabled selected hidden="">
                Choose
            </option>
<option value="free">
                Free
            </option>
<option value="pro">
                Pro
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
</div>
<div class="w-full">
<div class="relative flex items-stretch transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-lg)]">
<label for="floating_lang_lg_6a7e9b7556fd4" class="absolute left-[var(--px-input-lg)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Language <span class="text-error ml-0.5">*</span></label>
<select id="floating_lang_lg_6a7e9b7556fd4" name="floating_lang_lg" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-lg)] pl-[var(--px-input-lg)] pr-9 pt-5 pb-1" required="">
<option value="" disabled selected hidden="">
                Choose
            </option>
<option value="ja">
                Japanese
            </option>
<option value="en">
                English
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
</div>

floating — appearance variants

Please select

<x-select floating label="Soft" appearance="soft" placeholder="Choose"><option value="a">A</option><option value="b">B</option></x-select>
<x-select floating label="Underline" appearance="underline" placeholder="Choose"><option value="a">A</option><option value="b">B</option></x-select>
<x-select floating label="Ghost" appearance="ghost" placeholder="Choose"><option value="a">A</option><option value="b">B</option></x-select>
<x-select floating label="Error example" error="Please select" placeholder="Not selected"><option value="a">A</option><option value="b">B</option></x-select>
<div class="w-full">
<div class="relative flex items-stretch transition-colors rounded-[var(--radius-field)] bg-base-200 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)]">
<label for="select_6a7e9b7563a86" class="absolute left-[var(--px-input-md)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Soft</label>
<select id="select_6a7e9b7563a86" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-md)] pl-[var(--px-input-md)] pr-9 pt-4 pb-0.5">
<option value="" disabled selected hidden="">
                Choose
            </option>
<option value="a">
                A
            </option>
<option value="b">
                B
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
</div>
<div class="w-full">
<div class="relative flex items-stretch transition-colors bg-transparent border-b border-base-300 focus-within:border-primary h-[var(--h-field-md)]">
<label for="select_6a7e9b7563af9" class="absolute left-[var(--px-input-md)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Underline</label>
<select id="select_6a7e9b7563af9" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-md)] pl-[var(--px-input-md)] pr-9 pt-4 pb-0.5">
<option value="" disabled selected hidden="">
                Choose
            </option>
<option value="a">
                A
            </option>
<option value="b">
                B
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
</div>
<div class="w-full">
<div class="relative flex items-stretch transition-colors rounded-[var(--radius-field)] bg-transparent tune-border border-transparent hover:bg-base-200/60 focus-within:bg-base-200 h-[var(--h-field-md)]">
<label for="select_6a7e9b7563b5f" class="absolute left-[var(--px-input-md)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Ghost</label>
<select id="select_6a7e9b7563b5f" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-md)] pl-[var(--px-input-md)] pr-9 pt-4 pb-0.5">
<option value="" disabled selected hidden="">
                Choose
            </option>
<option value="a">
                A
            </option>
<option value="b">
                B
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
</div>
<div class="w-full">
<div class="relative flex items-stretch transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)]">
<label for="select_6a7e9b7563bc1" class="absolute left-[var(--px-input-md)] top-1 text-[length:var(--text-field-xs)] text-base-content/60 pointer-events-none">Error example</label>
<select id="select_6a7e9b7563bc1" class="flex-1 min-w-0 w-full h-full bg-transparent border-0 outline-none appearance-none leading-none text-[length:var(--text-field-md)] pl-[var(--px-input-md)] pr-9 pt-4 pb-0.5">
<option value="" disabled selected hidden="">
                Not selected
            </option>
<option value="a">
                A
            </option>
<option value="b">
                B
            </option>
</select>
<span class="absolute inset-y-0 right-0 flex items-center pr-3 text-base-content/40 pointer-events-none"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 20 20" fill="currentcolor" class="w-4 h-4">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg></span>
</div>
<p class="mt-1.5 text-[length:var(--text-field-sm)] text-error">
        Please select
    </p>
</div>

disabled

<x-select label="Disabled" disabled placeholder="No action available"><option value="a">A</option></x-select>
<x-select label="Disabled (with value)" disabled>
    <option value="a" selected>Selected value</option>
    <option value="b">B</option>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="select_6a7e9b7573d94" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Disabled</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'No action available', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b7573d94" class="sr-only" tabindex="-1" aria-hidden="true" disabled>
<option value="" disabled selected hidden="">
                No action available
            </option>
<option value="a">
                A
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="select_6a7e9b7573e01" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Disabled (with value)</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: '请选择', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b7573e01" class="sr-only" tabindex="-1" aria-hidden="true" disabled>
<option value="a" selected>
                Selected value
            </option>
<option value="b">
                B
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

custom UI(单选)

<x-select custom label="Country" name="country_custom" placeholder="Select a country">
    <option value="jp">Japan</option>
    <option value="us">United States</option>
    <option value="uk">United Kingdom</option>
    <option value="fr">France</option>
    <option value="de" disabled>Germany (paused)</option>
    <option value="kr">South Korea</option>
</x-select>
<x-select custom appearance="soft" color="primary" label="Plan" name="plan_custom" placeholder="Choose a plan">
    <option value="free">Free</option>
    <option value="pro">Pro</option>
    <option value="enterprise">Enterprise</option>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="country_custom_6a7e9b759d2e9" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Country</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Select a country', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="country_custom_6a7e9b759d2e9" class="sr-only" tabindex="-1" aria-hidden="true" name="country_custom">
<option value="" disabled selected hidden="">
                Select a country
            </option>
<option value="jp">
                Japan
            </option>
<option value="us">
                United States
            </option>
<option value="uk">
                United Kingdom
            </option>
<option value="fr">
                France
            </option>
<option value="de" disabled>
                Germany (paused)
            </option>
<option value="kr">
                South Korea
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="plan_custom_6a7e9b759d361" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Plan</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Choose a plan', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="plan_custom_6a7e9b759d361" class="sr-only" tabindex="-1" aria-hidden="true" name="plan_custom">
<option value="" disabled selected hidden="">
                Choose a plan
            </option>
<option value="free">
                Free
            </option>
<option value="pro">
                Pro
            </option>
<option value="enterprise">
                Enterprise
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-primary/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-primary/10 text-primary border-primary/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-primary/10 text-primary ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-primary" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

custom UI(多选·chips)

<x-select custom multiple label="Fruits" name="fruits_custom" placeholder="Select several">
    <option value="apple">Apple</option>
    <option value="banana">Banana</option>
    <option value="cherry">Cherry</option>
    <option value="durian">Durian</option>
    <option value="elderberry">Elderberry</option>
</x-select>
<x-select custom multiple appearance="soft" color="success" label="Tags" name="tags_custom" placeholder="Select several tags">
    <option value="frontend">frontend</option>
    <option value="backend">backend</option>
    <option value="design">design</option>
    <option value="devops">devops</option>
    <option value="docs">docs</option>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="fruits_custom_6a7e9b75c8225" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Fruits</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: true, placeholder: 'Select several', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="fruits_custom_6a7e9b75c8225" class="sr-only" tabindex="-1" aria-hidden="true" name="fruits_custom[]" multiple>
<option value="apple">
                Apple
            </option>
<option value="banana">
                Banana
            </option>
<option value="cherry">
                Cherry
            </option>
<option value="durian">
                Durian
            </option>
<option value="elderberry">
                Elderberry
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="tags_custom_6a7e9b75c829a" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">Tags</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: true, placeholder: 'Select several tags', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="tags_custom_6a7e9b75c829a" class="sr-only" tabindex="-1" aria-hidden="true" name="tags_custom[]" multiple>
<option value="frontend">
                frontend
            </option>
<option value="backend">
                backend
            </option>
<option value="design">
                design
            </option>
<option value="devops">
                devops
            </option>
<option value="docs">
                docs
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-success/10 tune-border border-transparent focus-within:ring-1 focus-within:ring-success min-h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-success/10 text-success border-success/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-success/10 text-success ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-success" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>

custom UI — error / disabled

Please select

<x-select custom label="Required" name="req_custom" required error="Please select" placeholder="Not selected">
    <option value="a">A</option>
    <option value="b">B</option>
</x-select>
<x-select custom label="No action available" disabled placeholder="No action available">
    <option value="a" selected>Selected value</option>
    <option value="b">B</option>
</x-select>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="req_custom_6a7e9b75f25f4" class="block text-[length:var(--text-field-sm)] font-medium text-error">Required <span class="text-error ml-0.5">*</span></label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'Not selected', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="req_custom_6a7e9b75f25f4" class="sr-only" tabindex="-1" aria-hidden="true" name="req_custom" required="">
<option value="" disabled selected hidden="">
                Not selected
            </option>
<option value="a">
                A
            </option>
<option value="b">
                B
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-error focus-within:ring-1 focus-within:ring-error h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 cursor-pointer" @click="open = !open" :aria-expanded="open"><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-error/10 text-error border-error/30"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-error/10 text-error ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-error" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
<p class="mt-1.5 text-[length:var(--text-field-sm)] text-error">
        Please select
    </p>
</div>
<div class="w-full">
<div class="flex items-baseline justify-between mb-1.5">
<label for="select_6a7e9b75f2667" class="block text-[length:var(--text-field-sm)] font-medium text-base-content">No action available</label>
</div>
<div class="relative w-full" x-data="{ open: false, multi: false, placeholder: 'No action available', values: [], options: [], init() { const sel = this.$refs.native; this.options = Array.from(sel.options) .filter(o =&gt; !o.hidden) .map(o =&gt; ({ value: o.value, label: o.text, disabled: o.disabled })); // Defer reading selectedOptions until after Alpine finishes applying // this tree's other bindings (notably wire:model/x-model on the native // &lt;select&gt; itself). Without this, init() runs before the child select's // own binding corrects its value, so the cached `values` — and the // trigger label bound to it — get stuck on the pre-bind SSR state // (placeholder or first &lt;option&gt;) even though the native select and // the Livewire property end up correct. this.$nextTick(() =&gt; { this.values = Array.from(sel.selectedOptions).map(o =&gt; o.value).filter(v =&gt; v !== ''); }); }, toggle(value, isDisabled) { if (isDisabled) return; if (this.multi) { const i = this.values.indexOf(value); if (i &gt;= 0) this.values.splice(i, 1); else this.values.push(value); } else { this.values = [value]; this.open = false; } this.sync(); }, remove(value) { this.values = this.values.filter(v =&gt; v !== value); this.sync(); }, sync() { const sel = this.$refs.native; Array.from(sel.options).forEach(o =&gt; o.selected = this.values.includes(o.value)); sel.dispatchEvent(new Event('change', { bubbles: true })); }, isSelected(v) { return this.values.includes(v); }, optionFor(v) { return this.options.find(o =&gt; o.value === v); }, }" @keydown.escape.window="open = false" @click.outside="open = false">
<select x-ref="native" id="select_6a7e9b75f2667" class="sr-only" tabindex="-1" aria-hidden="true" disabled>
<option value="" disabled selected hidden="">
                No action available
            </option>
<option value="a" selected>
                Selected value
            </option>
<option value="b">
                B
            </option>
</select>
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"></span></button>
<template x-if="!multi">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="flex-1 min-w-0 flex items-center flex-wrap gap-1"><span :class="values.length ? 'truncate text-[length:var(--text-field-md)] text-base-content' : 'truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40'" x-text="values.length ? optionFor(values[0])?.label : placeholder"></span></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-if="multi &amp;&amp; values.length === 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="truncate text-[length:var(--text-field-md)] text-base-content text-base-content/40" x-text="placeholder"></span></button>
</template><button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-if="multi &amp;&amp; values.length &gt; 0">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled></button>
<template x-for="v in values" :key="v">
<button type="button" class="relative w-full flex items-center gap-2 text-left transition-colors rounded-[var(--radius-field)] bg-base-100 tune-border border-base-300 focus-within:border-primary focus-within:ring-1 focus-within:ring-primary h-[var(--h-field-md)] px-[var(--px-input-md)] py-1 opacity-60 cursor-not-allowed pointer-events-none" @click="open = !open" :aria-expanded="open" disabled><span class="inline-flex items-center gap-1 px-2 py-0.5 rounded-full border text-[length:var(--text-field-xs)] bg-base-200 text-base-content border-base-300"><span x-text="optionFor(v)?.label"></span>
<button type="button" class="shrink-0 inline-flex text-current/60 hover:text-current cursor-pointer" @click.stop="remove(v)" aria-label="Remove"><svg class="size-3" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2.5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg></button></span></button>
</template>
</template><svg class="pointer-events-none shrink-0 size-4 text-base-content/40 transition-transform" :class="open ? 'rotate-180' : ''" viewbox="0 0 20 20" fill="currentcolor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 011.06 0L10 11.94l3.72-3.72a.75.75 0 111.06 1.06l-4.25 4.25a.75.75 0 01-1.06 0L5.22 9.28a.75.75 0 010-1.06z" clip-rule="evenodd"></path></svg>
<ul x-show="open" x-cloak="" x-transition.opacity.duration.100ms="" class="absolute z-40 mt-1 w-full max-h-72 overflow-auto bg-base-100 tune-border border-base-300 rounded-[var(--radius-field)] shadow-[var(--shadow-box)] p-1" role="listbox" :aria-multiselectable="multi">
<template x-for="opt in options" :key="opt.value">
</template>
<li class="flex items-center justify-between gap-2 px-3 py-2 rounded-[var(--radius-field)] cursor-pointer text-base-content hover:bg-base-200 transition-colors text-[length:var(--text-field-md)]" :class="(isSelected(opt.value) ? 'bg-base-200 font-medium ' : '') + (opt.disabled ? 'opacity-50 cursor-not-allowed pointer-events-none' : '')" role="option" :aria-selected="isSelected(opt.value)" @click="toggle(opt.value, opt.disabled)">
<span x-text="opt.label"></span>
<svg x-show="isSelected(opt.value)" class="shrink-0 size-4 text-base-content" viewbox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="3" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"></path></svg>
</li>
</ul>
</div>
</div>