Inputs
Checkbox
Binary or indeterminate selection control built on Bits UI with full keyboard support.
<script>
import { Checkbox } from "@codeatlasdev/ui";
let accepted = $state(false);
</script>
<Checkbox label="I accept the terms" bind:checked={accepted} />
A checkbox rendered without label (for example in a table row) needs an aria-label. Space toggles it.
States
Unchecked, checked and indeterminate.
Code
Disabled
Code
Without label
Bare checkbox for table rows or custom layouts.
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | false | Bindable checked state. |
indeterminate | boolean | false | Renders the mixed state. |
disabled | boolean | false | Disables interaction. |
label | string | – | Visible label rendered beside the checkbox. |
aria-label | string | – | Accessible name used when no visible label is rendered. |
aria-labelledby | string | – | Id of an element that names the checkbox. Ignored when label is set. |
class | string | – | Extra classes on the wrapper. |
onchange | (checked: boolean) => void | – | Called when the checked state changes. |