Skip to content

Checkbox ​

Composable checkbox runtime: Root owns checked state; Indicator only renders when checked.

Runtime ​

State contracts come from @varo-ui/headless; rendered parts come from @varo-ui/h5/primitives or @varo-ui/weapp/primitives.

Demo ​

Package@varo-ui/headless

Basic usage ​

Use the Demo panel above to switch H5 and Weapp primitive preview/code; each runtime renders only the current entry.

Disabled state ​

When disabled is set, checkedChange no longer fires. Indicator may still reflect the current checked value, but interaction is closed.

Parts ​

PartPurpose
CheckboxRootState and toggle interaction
CheckboxIndicatorIndicator rendered when checked

Props ​

PropTypeDefaultDescription
checkedboolean | undefinedundefinedControlled checked state
defaultCheckedbooleanfalseUncontrolled initial checked state
disabledbooleanfalseDisables interaction
asstring'button'Root element tag

Events ​

EventPayloadDescription
update:checkedbooleanSync controlled checked state
checkedChangebooleanFires when checked changes

Accessibility ​

  • Root defaults to button semantics for toggling.
  • Indicator is not the click target.
  • Disabled state must not emit checked changes.

Platform notes

  • H5 can be previewed live in docs.
  • Mini-program keeps the same v-model:checked and part composition; focus details stay page-owned. :::