View laravel-hotwire on GitHub
1M
v0.91.0
Search 71 components and 72 controllers by name, category or description.
Checkbox Group
Native checkbox set with generated or rich items, validation and optional select-all control
Options
Render native checkboxes from value and label pairs.
<hw:checkbox-group
name="roles[]"
:options="['admin' => 'Admin', 'editor' => 'Editor', 'viewer' => 'Viewer']"
:selected="['editor']"
/>
Flat array
Flat arrays use the label as the submitted value.
<hw:checkbox-group
name="branches[]"
:options="['main', 'dev', 'next']"
:selected="['main', 'dev']"
/>
Horizontal
Use orientation as a layout hook for inline choices.
<hw:checkbox-group
name="notifications[]"
orientation="horizontal"
:options="['Email', 'Slack', 'SMS']"
:selected="['Email', 'Slack']"
/>
Rich items
Use item children when each option needs more markup.
<hw:checkbox-group name="permissions[]" :selected="['editor']">
<hw:checkbox-group.item value="admin">
<span class="font-medium">Admin</span>
<span class="text-muted-foreground">Can manage billing and users.</span>
</hw:checkbox-group.item>
<hw:checkbox-group.item value="editor">
<span class="font-medium">Editor</span>
<span class="text-muted-foreground">Can publish and update content.</span>
</hw:checkbox-group.item>
<hw:checkbox-group.item value="viewer">
<span class="font-medium">Viewer</span>
<span class="text-muted-foreground">Can read content without editing it.</span>
</hw:checkbox-group.item>
</hw:checkbox-group>
Select all
Add a master checkbox that toggles every item.
<hw:checkbox-group
name="tags[]"
:options="[1 => 'Laravel', 2 => 'Hotwire', 3 => 'Stimulus']"
:selected="[1, 2]"
select-all
select-all-label="All tags"
/>
Inside a field
The group inherits name and validation metadata from the field.
Choose which modules should be enabled.
<hw:field name="features[]" label="Features" description="Choose which modules should be enabled.">
<hw:checkbox-group
:options="['tasks' => 'Tasks', 'files' => 'Files', 'messages' => 'Messages']"
:selected="['tasks', 'files']"
/>
</hw:field>
Auto-submit
Use GET for demo filters so toggling does not POST to the current page.
<hw:form method="get" :action="route('components.checkbox-group')" auto-submit>
<hw:checkbox-group
name="filters[]"
:options="['open' => 'Open', 'closed' => 'Closed', 'archived' => 'Archived']"
:selected="['open']"
auto-submit
/>
</hw:form>