컴포넌트
Switch
켜고 끄기.
import { Label } from '@zest/primitives/Label.js'
import { Switch } from '@zest/primitives/Switch.js'
export default function Demo() {
return (
<div className="flex flex-col gap-3">
<div className="flex items-center gap-2"><Switch id="a" defaultChecked /><Label htmlFor="a">출근 알림</Label></div>
<div className="flex items-center gap-2"><Switch id="b" /><Label htmlFor="b">주간 리포트</Label></div>
</div>
)
}설치
shadcn CLI 로 소스를 프로젝트에 가져와요. 테마·유틸·의존 부품이 함께 설치돼요.
npx shadcn@latest add @zest/switch패키지로 쓰려면 @zest-im/ui 에서 가져와요. 설치 안내
사용법
import { Switch } from '@/components/ui/switch'위 미리보기의 「코드」 탭이 실제로 동작하는 예제예요.