A compact boolean control with checked motion and disabled state.
OnOffDisabled
Rule enabled
<Toggle label="Enable rule" bind:checked />Installation
pnpm add @chanrg/4uiImport the stylesheet once, at the root of your app:
import '@chanrg/4ui/styles.css';Usage
import { Toggle } from '@chanrg/4ui';<Toggle label="Enable rule" bind:checked />API reference
Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | false | Bindable state. |
onchange | (checked) => void | — | State callback. |
CSS variables
| Variable | Description |
|---|---|
--4ui-surface | Primary component surface. |
--4ui-text | Primary foreground color. |
--4ui-border | Default control and panel border. |
Accessibility
- Uses a button with aria-pressed and a mandatory label.