Forms
Switch
Turns a setting on or off at once. Exported as SwitchToggle and as Switch. SpringToggle adds a thumb that stretches while pressed.
Group: Forms. Exports: SwitchToggle, SpringToggle. shadcn/ui equivalent: Switch (partial parity).
Usage
import { SwitchToggle } from "./halaska-kit";
SwitchToggle props
checkedboolean: The controlled checked state.onChange(value) => void: Called with the new value.labelstring: Visible label."aria-label"any:
SpringToggle props
checkedboolean: The controlled checked state.onChange(value) => void: Called with the new value.labelstring: Visible label."aria-label"any:
Accessibility
- Renders a native button with the switch role and aria-checked.
- Enter and Space toggle it, and the focus ring shows for keyboard users.
- The label text wraps the button, so clicking the text toggles it too.
- Without a label the switch has no accessible name.
Known gaps
- No disabled state.
- One size.
- No description slot, and no invalid state.
Used in
Halaska UI · Components · Patterns · Screens · Install