Switch
Forms & Input

Switch

Render a labeled switch with controlled or uncontrolled checked state.

Props

Switch extends ButtonHTMLAttributes<HTMLButtonElement>. Renders as role="switch" with aria-checked.

SwitchProps props
PropTypeDefaultDescription
checkedboolean—On/off state.
onChange(checked: boolean) => void—Toggle handler.
disabledboolean—Prevents interaction.

Examples

On / off

Switch on and off

Interactive

Interactive switch

Disabled

Disabled switch
ImportTSX
import { Switch } from "@solarius/onset";
import type { SwitchProps } from "@solarius/onset";