Components
Switch
An accessible toggle switch.
Use Switch to toggle a boolean setting on or off.
import { useState } from 'react';
import { Switch } from '@tile-ui/react';
export default function SwitchDemo() {
const [checked, setChecked] = useState(true);
Registry install
pnpm dlx shadcn@latest add @tile-ui/switchPackage usage
import { Switch } from '@tile-ui/react';
<Switch />Highlights
- Two sizes
- Accessible switch role
- Pairs with Field and Form
Registry dependencies
| Item | Purpose |
|---|---|
switch | Component source and module styles |
core | Framework-agnostic logic helpers |
styles | Shared SCSS tokens and globals |
API reference
Switch
| Prop | Type | Default |
|---|---|---|
size | 'default' | 'sm' | — |