{"slug":"checkbox","name":"Checkbox","category":"Form & Input","summary":"A binary choice with an optional label and a mixed state.","status":"stable","since":"0.1.0","import":"import { Checkbox } from '@elluzion/iv-ui';","usage":["Bind `checked` for two-way state; `onchange` receives `{ checked }`.","Use `indeterminate` for a parent control that represents a partial selection.","Pass `label` for the visible text; the label is part of the click target."],"props":[{"name":"checked","type":"boolean","default":"false","description":"Checked state. Bind with `bind:checked`.","required":false,"bindable":true},{"name":"indeterminate","type":"boolean","default":"false","description":"Renders the mixed state; useful for “select all”.","required":false,"bindable":false},{"name":"disabled","type":"boolean","default":"false","description":"Disables interaction and applies the disabled treatment.","required":false,"bindable":false},{"name":"required","type":"boolean","default":"false","description":"Marks the field as required.","required":false,"bindable":false},{"name":"label","type":"string","default":"''","description":"Label text rendered next to the box.","required":false,"bindable":false},{"name":"name","type":"string","default":"''","description":"Form field name submitted with the surrounding form.","required":false,"bindable":false},{"name":"value","type":"string","default":"''","description":"Value submitted with the form when checked.","required":false,"bindable":false},{"name":"size","type":"'sm' | 'md'","default":"'md'","description":"Control size.","required":false,"bindable":false}],"events":[{"name":"change","type":"(e: CustomEvent<{ checked: boolean }>) => void","default":null,"description":"Called with `{ checked }` after the state changes.","required":false,"bindable":false},{"name":"focus","type":"(e: FocusEvent) => void","default":null,"description":"Called when the control receives focus.","required":false,"bindable":false},{"name":"blur","type":"(e: FocusEvent) => void","default":null,"description":"Called when the control loses focus.","required":false,"bindable":false}],"snippets":[{"name":"children","type":"Snippet","default":null,"description":"Content rendered inside the component.","required":false,"bindable":false}],"types":[],"manual":[],"tokens":["--iv_border","--iv_control-md","--iv_control-sm","--iv_disabled-opacity","--iv_ease-out","--iv_font-ui","--iv_foreground","--iv_foreground-inverse","--iv_leading-tight","--iv_outline-offset","--iv_outline-width","--iv_radius-sm","--iv_spacing-sm","--iv_surface-raised","--iv_text-body","--iv_transition-fast"],"cssHooks":["iv-box","iv-checked","iv-disabled","iv-indeterminate","iv-label","iv-md","iv-native","iv-root","iv-sm"],"accessibility":{"keyboard":[["Tab","Moves focus to the checkbox."],["Space","Toggles the checked state."]],"notes":["A native checkbox input backs the control, so form submission works without extra wiring.","`indeterminate` is applied to the native input and announced as mixed.","Focus is drawn on the box and is never removed."]},"related":[{"title":"Switch","summary":"An on/off control that applies immediately.","url":"/components/switch","kind":"Component"},{"title":"RadioGroup","summary":"A set of mutually exclusive options with one selected value.","url":"/components/radio-group","kind":"Component"},{"title":"Toggle","summary":"A pressable button that keeps a checked state.","url":"/components/toggle","kind":"Component"},{"title":"Field","summary":"Labels a custom control and renders its helper or error message.","url":"/components/field","kind":"Component"}],"examples":[{"id":"states","title":"States","description":"Unchecked, checked, mixed, and disabled.","code":"<script lang=\"ts\">\n\timport { Checkbox } from '@elluzion/iv-ui';\n\n\tlet unchecked = $state(false);\n\tlet checked = $state(true);\n\tlet mixed = $state(false);\n</script>\n\n<div class=\"stack\">\n\t<Checkbox label=\"Unchecked\" bind:checked={unchecked} />\n\t<Checkbox label=\"Checked\" bind:checked />\n\t<Checkbox label=\"Mixed\" indeterminate bind:checked={mixed} />\n\t<Checkbox label=\"Disabled\" checked disabled />\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"sizes","title":"Sizes","description":"`sm` and `md`; `md` is the default.","code":"<script lang=\"ts\">\n\timport { Checkbox } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"stack\">\n\t<Checkbox label=\"Small\" size=\"sm\" checked />\n\t<Checkbox label=\"Medium\" checked />\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"events","title":"Events","description":"The change event carries `{ checked }` and the bound value stays in sync.","code":"<script lang=\"ts\">\n\timport { Checkbox } from '@elluzion/iv-ui';\n\n\tlet checked = $state(false);\n\tlet changes = $state(0);\n</script>\n\n<div class=\"stack\">\n\t<Checkbox label=\"Watch this repository\" bind:checked onchange={() => changes++} />\n\t<p class=\"readout\">checked {checked} · changes {changes}</p>\n</div>\n\n<style>\n\t.stack {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n\n\t.readout {\n\t\tmargin: 0;\n\t\tfont-family: var(--iv_font-mono);\n\t\tfont-size: var(--iv_text-sm);\n\t\tcolor: var(--iv_foreground-dim);\n\t}\n</style>"}],"markdown":"/components/checkbox.md","page":"/components/checkbox"}