Base Pure CSS

Checkbox

The native checkbox with label and description, an indeterminate state and validation errors.

Real scenarios

The component as it is used in a product — not a specimen grid.

The store’s notification settings

Each channel is a live checkbox — the counter rolls as you click, and the label itself is clickable. SMS stays disabled until a phone number is verified.

0 of 3 channels on

Verify a number in profile → security to unlock the fourth channel.

Checkout, with the terms gate

The required consent unlocks the pay button — until then it stays disabled. The marketing opt-in beside it is optional and changes nothing.

  • NabuConf ticket × 2 890,000 Toman
  • Motion workshop seat 700,000 Toman
  • Order total 2,480,000 Toman

The pay button unlocks the moment you accept the terms.

Picking invoices for the next payment batch

Tick a few rows and the select-all checkbox settles into its indeterminate dash — check it and everything lights up; check it again and the batch empties. The sum rolls with the picks.

0 invoices · 0 Toman

Important props

Important props
Prop Type Default What it does
label / description string null The clickable label and its description; without them the bare checkbox renders.
indeterminate bool false The “some selected” state — like a table’s select-all.
wire:model / $errors — — Every native attribute (disabled, value, aria-label, wire:model…) lands on the input itself; an $errors entry under the field name turns on aria-invalid and the red frame.

Snippet

<x-nx::checkbox label="خبرنامهٔ هفتگی" description="هر پنجشنبه، فقط محصول"
    wire:model="state.newsletter" />

<x-nx::checkbox label="پیامک تراکنش‌ها" description="شمارهٔ شما هنوز تأیید نشده" disabled />

<x-nx::checkbox label="همهٔ فاکتورها" indeterminate wire:click="selectAll" />