@thebase/ui
Version:
CDN-installable Owl and Bootstrap 5 UI component library.
36 lines (26 loc) • 858 B
Markdown
# Switch
Checkbox-backed switch control using `role="switch"`.
## Pure Owl component
```js
import { Switch } from "@thebase/ui";
```
```base-ui
<div class="d-flex align-items-center gap-2" style="max-width: 28rem">
<Switch>Airplane Mode</Switch>
</div>
```
| Component | Prop | Type | Notes |
| --- | --- | --- | --- |
| `Switch` | `checked` | `Boolean` | optional |
| `Switch` | `disabled` | `Boolean` | optional |
| `Switch` | `className` | `String` | optional |
| `Switch` | `onChange` | `Function` | optional |
See [Pure Owl Components](/examples/blocks.html#/docs/guide/owl-components) for how to load `@base/owl` and `dist/baseui.templates.xml`.
## Static component
```base-ui
<label b-ui="switch">
<input type="checkbox" role="switch">
Auto-save
</label>
```
Accessibility: keep the native checkbox input and use clear on/off labeling.