Forms

Switch

A single `<input role="switch">`. v0 fired two different event shapes — a synthesised `{target:{checked}}` from a wrapper div's onClick, and the real onChange from the inner input — and which one you got depended on where you clicked.

data-scope="switch"

Usage

<Switch label="Notifications" onChange={e => set(e.target.checked)} />
<Switch v-model="on" label="Notifications" />
<Switch bind:checked={on} label="Notifications" />
<ck-switch label="Notifications" [(checked)]="on" />

Props

PropTypeDefaultNotes
size"sm" | "md" | "lg""md"Control size.
labelReactNodeLabel text.

Prop names are identical in all four frameworks. Only two-way binding differs, and each framework uses its own idiom over the same underlying prop.

Migrating from react-ui-toolkit

v0v1Notes
two competing change eventsone native change eventHandlers that ran twice, or not at all, now run exactly once.