Fluixi UI
GitHub ↗

Examples

Loading preview…

toggle

Pressable on/off button following the WAI-ARIA button pattern.


A headless toggle button — a button with aria-pressed and data-state (on / off). Controlled or uncontrolled.

Installation

pnpm add @fluixi/toggle

Usage

import { Toggle } from '@fluixi/toggle';

<Toggle defaultPressed onChange={setPressed}>Bold</Toggle>
<Toggle pressed={bold()} onChange={setBold}><BoldIcon /></Toggle>
  • pressed / defaultPressed / onChange for controlled/uncontrolled state.
  • disabled suppresses toggle; aria-pressed and data-state are always accurate.

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