bit Bheadless

Checkbox

An accessible tri-state checkbox primitive with full keyboard support and zero visual opinion.

Implementation: CSS Tailwind

Basic Checkbox (Uncontrolled)

Renders a native <button> with role="checkbox" and aria-checked. Click or press Space to toggle. DefaultChecked seeds the initial state.

Controlled

Drive state externally with Checked + OnCheckedChange.

Terms accepted: no

Disabled

Set Disabled="true" to block interaction. Receives the native disabled attribute and a data-disabled hook.

Indeterminate (Select All pattern)

Setting Indeterminate="true" emits aria-checked="mixed" and data-state="indeterminate". The classic use-case is a "select all" checkbox that reflects partial child selection. Clicking an indeterminate checkbox advances it to checked.

With label

Wrap the checkbox in a <label> so clicking the text toggles the checkbox — standard HTML behaviour.

Form Submission

Set Name to render an adjacent <input type="hidden"> so the checkbox state participates in plain form posts. The hidden input is only present when the checkbox is checked or indeterminate, mirroring native checkbox behaviour.

Group with select all

BitBhCheckboxGroup binds one collection with @bind-Values and renders role="group"; each BitBhCheckbox with a Value toggles that value. SelectAll="true" turns a checkbox into the tri-state parent — checked when every value is selected, aria-checked="mixed" / data-state="indeterminate" when only some are. BitBhCheckboxIndicator renders only while its checkbox is checked or mixed, and mirrors its data-state.

Values: Cheese, Olives
An unhandled error has occurred. Reload 🗙