Fluixi UI
GitHub ↗

Examples

Loading preview…

switch

Accessible toggle switch following the WAI-ARIA switch pattern.


A headless toggle switch following the WAI-ARIA switch pattern. Controlled or uncontrolled.

import { Switch } from '@fluixi/switch';

<Switch defaultChecked onChange={(checked) => ...} />
<Switch checked={enabled()} onChange={setEnabled} />
  • checked / defaultChecked / onChange — controllable state.
  • Reflects aria-checked, data-state (checked | unchecked) and data-disabled.
  • Renders a native button[role=switch], so keyboard activation works out of the box.

Part of the Fluixi UI component library. Made with ☕ by the Fluixi team.