Components › Components

Switch and checkbox

On or off: a native checkbox in its label (role="switch" for the switch), bound two ways.

Styled: Switch and checkbox on ui.clarusjs.com, ready to copy, in plain CSS or Tailwind.

tscl
@import uiSwitch from '@clarusjs/ui-primitives/switch.tscl'
@import uiCheckbox from '@clarusjs/ui-primitives/checkbox.tscl'

<uiSwitch label="Notifications" [(checked)]="settings.notify" />
<uiCheckbox label="I agree to the terms" [(checked)]="agreed" />

From @clarusjs/ui-primitives, styled by @clarusjs/ui: @import '@clarusjs/ui/ui.css' once, and change the look with its --ui- tokens (--ui-accent, --ui-radius, --ui-font…). Without it, the part is unstyled and works the same.