Switch
Sliding pill toggle switch track and animated thumb.
Usage
import { Switch, SwitchThumb } from "@ilha/ui-sdk/switch";
import { switchRoot, switchThumb } from "coatx/switch";
export const AlertsSwitch = () => (
<Switch
aria-label="Alerts"
class={(state) => switchRoot({ checked: state.checked }).class}
>
<SwitchThumb
class={(state) => switchThumb({ checked: state.checked }).class}
/>
</Switch>
);
Exports (coatx/switch)
| Export | Description |
|---|---|
switchRoot(options?) |
Switch track recipe |
switchThumb(options?) |
Sliding thumb recipe |
switchStyles |
Compiled StyleX style map |
Options
| Option | Type | Default |
|---|---|---|
checked |
boolean |
false |
size |
"default", "sm" |
"default" |
disabled |
boolean |
false |