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/switch

Package usage

import { Switch } from '@tile-ui/react';
 
<Switch />

Highlights

  • Two sizes
  • Accessible switch role
  • Pairs with Field and Form

Registry dependencies

ItemPurpose
switchComponent source and module styles
coreFramework-agnostic logic helpers
stylesShared SCSS tokens and globals

API reference

Switch

PropTypeDefault
size'default' | 'sm'