View laravel-hotwire on GitHub
1M
v0.91.0
Search 71 components and 72 controllers by name, category or description.
Toggle Group
Pressed-button group with single or multiple selection, optional form submission and auto-submit
Toggle group
<hw:toggle-group name="format" type="multiple" :value="['bold']" connected>
<hw:toggle-group.item value="bold">Bold</hw:toggle-group.item>
<hw:toggle-group.item value="italic">Italic</hw:toggle-group.item>
<hw:toggle-group.item value="underline">Underline</hw:toggle-group.item>
</hw:toggle-group>
Options shortcut
Since 0.77: pass [value => label] pairs through :options instead of composing each item.
<hw:toggle-group
name="density"
type="single"
value="comfortable"
:options="[
'compact' => 'Compact',
'comfortable' => 'Comfortable',
'spacious' => 'Spacious',
]"
/>
Flat options
A flat array uses each string as both the submitted value and the label.
<hw:toggle-group name="formats" :value="['bold']" :options="['bold', 'italic', 'underline']" connected />
Options plus composition
Generated options render before the slot. Compose an item when it needs rich content, disabled, attributes or Stimulus bindings.
<hw:toggle-group name="tools" :options="['bold' => 'Bold', 'italic' => 'Italic']" connected>
<hw:toggle-group.item value="link" disabled>
<x-lucide-link class="size-4" />
Link
</hw:toggle-group.item>
</hw:toggle-group>