EN
Getting started
67 · Forms

Checkbox and radio

A checkbox (acun:checkbox) and a radio button (acun:radio) in the brand color. The label is drawn inside the component; since the id is derived from the field name and value, the label is always linked to the box.

acun:checkbox · acun:radio
01

Checkbox

Pass the label with label; clicking the label also checks the box. Pass checked to have it checked initially. A checked box sends the value 1 by default; for a different value, use the value attribute.

LIVE EXAMPLE
<div class="flex flex-col gap-3">
    <acun:checkbox name="email_notification" label="Email notification" checked />
    <acun:checkbox name="sms_notification" label="SMS notification" />
</div>
PropValues
labelText next to the box
checkedtrue | false
02

Radio button

Give the buttons in the same group the same name and each a different value; only one of the group can be selected. The button id is generated as name-value.

LIVE EXAMPLE
<div class="flex flex-wrap gap-6">
    <acun:radio name="customer_type" value="individual" label="Individual" checked />
    <acun:radio name="customer_type" value="corporate" label="Corporate" />
</div>
PropValues
nameGroup name
valueValue sent when selected
checkedtrue | false
03

Rich label

When label is not given, the slot is used as the label; useful when you need formatted content such as a link. Wrap the content in a single <span> so the gap between it and the box is not broken.

LIVE EXAMPLE
<acun:checkbox name="privacy_consent">
    <span>I have read and accept the <a href="#" class="font-medium text-brand-600 hover:underline dark:text-brand-400">privacy notice</a>.</span>
</acun:checkbox>
04

Disabled

The disabled attribute goes straight to the box or button; a disabled element is drawn faded, cannot be clicked, and the cursor turns into a not-allowed sign on hover. On radio buttons, the label turns gray as well.

LIVE EXAMPLE
<div class="flex flex-wrap gap-10">
    <div class="flex flex-col gap-3">
        <acun:checkbox name="auto_backup" label="Automatic backup" checked disabled />
        <acun:checkbox name="bulk_sms" label="Bulk SMS (no permission)" disabled />
    </div>
    <div class="flex flex-col gap-3">
        <acun:radio name="delivery_method" value="shipping" label="Standard shipping" checked />
        <acun:radio name="delivery_method" value="same_day" label="Same-day delivery (not available in this area)" disabled />
    </div>
</div>
PropValues
disabledAttribute
05

With Livewire

Bind a single checkbox to a bool property with wire:model, and several boxes bound to the same property to an array; the array holds the value values of the checked boxes. For radio buttons, the group name comes from wire:model. These two components do not show validation errors; add the message below the group yourself.

BLADE
<acun:checkbox wire:model="active" label="Active customer" />

<fieldset class="flex flex-col gap-3">
    <legend class="mb-2 text-sm font-medium text-gray-700 dark:text-zinc-300">Shipping days</legend>
    <acun:checkbox wire:model="days" value="monday" label="Monday" />
    <acun:checkbox wire:model="days" value="wednesday" label="Wednesday" />
    <acun:checkbox wire:model="days" value="friday" label="Friday" />
    @error('days') <p class="text-sm text-red-600">{{ $message }}</p> @enderror
</fieldset>

<acun:radio wire:model="priority" value="normal" label="Normal" />
<acun:radio wire:model="priority" value="urgent" label="Urgent" />
API

Props and slots

The values the component accepts.

PropDefaultDescription
checkbox: labelnullText next to it; the slot is used when not given
checkbox: namenullField name; defaults to the wire:model value
checkbox: checkedfalseInitially checked
checkbox: value (attribute)1Value sent while checked; the id becomes name-value
radio: labelnullText next to it; the slot is used when not given
radio: namenullGroup name; defaults to the wire:model value
radio: valuenullValue sent when selected; the id becomes name-value
radio: checkedfalseInitially selected
Slots: default (label content when label is not given)
Acun UI · Checkbox and radioDetailed usage and examples