Slide Toggle
A sliding toggle element that can capture input from a user.
import { SlideToggle } from '@brainandbones/skeleton';
Examples
Accent Colors
Sizes
Labeled
Disabled
Usage
let myValue: boolean = false;
<SlideToggle bind:checked={myValue}>(label)</SlideToggle>
<SlideToggle bind:checked={myValue} size="lg" />
<SlideToggle bind:checked={myValue} disabled />
Properties
This component makes use of $$restProps, which allows arbitrary attributes to be provided to the component.
Prop | Type | Default | Values | Description |
---|---|---|---|---|
checked | boolean | false | true | false | The checked state of the input element. |
accent | string | bg-accent-500 | class | Provide classes to set the checked state color. |
size | string | md | sm | md | lg | Sets the size of the component. |
Accessibility
ARIA GuidelinesProp | Required | Description |
---|---|---|
label | - | Provide a semantic label. |
Keyboard Interactions
Keys | Description |
---|---|
Space or Enter | When focus is on the slide toggle, changes the state of the slide toggle. |