Checkbox

A form-associated checkbox — works inside a native <form>, supports the indeterminate state, and offers card / toggle tile variants. See also Checkbox Group.

States

Unchecked Checked Indeterminate (parent) Disabled Disabled checked Invalid / required Loading
checkbox.html
html
1 <nana-checkbox name="terms" required>I agree to the terms</nana-checkbox>
2 <nana-checkbox checked>Subscribed</nana-checkbox>
3 <nana-checkbox indeterminate>Parent category</nana-checkbox>

Sizes

Size smSize mdSize lg

With description

Card & Toggle

Selectable tile
card.html
html
1 <nana-checkbox variant="card" checked label="Premium Plan" description="$29 / month"></nana-checkbox>
2 <nana-checkbox variant="toggle" checked>Selectable tile</nana-checkbox>

Import

main.ts
ts
1 import "@nana-tec/ui-components/checkbox";

Events

EventDetail
nana-change{ checked, indeterminate }

Customization

Branded blue Pink, rounded
checkbox.css
css
1 nana-checkbox.brand {
2 --nana-checkbox-accent: #2563eb;
3 --nana-checkbox-radius: 9999px;
4 }

Props

AttributeTypeDefaultDescription
checkedbooleanfalseChecked state
indeterminatebooleanfalseMixed state (some children selected)
disabledbooleanfalseDisable the control
requiredbooleanfalseRequired for form validation
invalidbooleanfalseInvalid styling + state
loadingbooleanfalseReplace the box with a spinner
valuestring"on"Submitted value when checked
namestringForm field name
labelstringLabel text (slot wins)
descriptionstringSecondary text
sizesm | md | lgmdControl size
variantdefault | card | toggledefaultVisual style

Accessibility

  • role="checkbox" with aria-checked (true / false / mixed).
  • Keyboard: Space / Enter toggles; focus ring on the box.
  • Form-associated — participates in <form>, reset and constraint validation.