View laravel-hotwire on GitHub
1M
v0.91.0
Search 71 components and 72 controllers by name, category or description.
Radio Group
Native radio group with generated or rich items, validation and auto-submit
Options
Render native radio inputs from value and label pairs.
<hw:radio-group
name="plan"
:options="['free' => 'Free', 'pro' => 'Pro', 'team' => 'Team']"
selected="pro"
/>
Flat array
Flat arrays use the label as the submitted value.
<hw:radio-group
name="deployment"
:options="['Manual', 'Scheduled', 'Automatic']"
selected="Scheduled"
/>
Horizontal
Use orientation as a layout hook for inline choices.
<hw:radio-group
name="billing_cycle"
orientation="horizontal"
:options="['monthly' => 'Monthly', 'yearly' => 'Yearly']"
selected="yearly"
/>
Rich items
Use item children when each option needs more markup.
<hw:radio-group name="plan_details" selected="pro">
<hw:radio-group.item value="free">
<span class="font-medium">Free</span>
<span class="text-muted-foreground">For personal projects.</span>
</hw:radio-group.item>
<hw:radio-group.item value="pro">
<span class="font-medium">Pro</span>
<span class="text-muted-foreground">For growing teams.</span>
</hw:radio-group.item>
<hw:radio-group.item value="enterprise">
<span class="font-medium">Enterprise</span>
<span class="text-muted-foreground">For advanced security and support.</span>
</hw:radio-group.item>
</hw:radio-group>
Inside a field
The group inherits name and validation metadata from the field.
Choose who can see this project.
<hw:field name="visibility" label="Visibility" description="Choose who can see this project.">
<hw:radio-group :options="['public' => 'Public', 'private' => 'Private']" selected="public" />
</hw:field>
Disabled item
Disable a single rich item while keeping the rest available.
<hw:radio-group name="region" selected="us-east">
<hw:radio-group.item value="us-east">US East</hw:radio-group.item>
<hw:radio-group.item value="eu-west">EU West</hw:radio-group.item>
<hw:radio-group.item value="ap-south" disabled>AP South</hw:radio-group.item>
</hw:radio-group>
Auto-submit
Wire every radio change to the nearest auto-submit form.
<hw:form method="get" :action="route('components.radio-group')" auto-submit>
<hw:radio-group
name="density"
:options="['comfortable' => 'Comfortable', 'compact' => 'Compact']"
selected="comfortable"
auto-submit
/>
</hw:form>