Inputs
Switch
즉시 효과를 갖는 on/off 토글.
폼 제출 없이 즉시 반영되는 설정용. 폼 안에서 제출 시점에 적용되는 다중 선택은 Checkbox를 사용. Radix Switch 기반.
import { Switch } from "@nxtgen-org/react";
Basic
Controlled
tsx
const [on, setOn] = useState(true);<Switch checked={on} onCheckedChange={setOn} />
With label & description
Compound 라벨
에이전트 응답 완료 시 데스크톱 알림.
tsx
<Switchlabel="알림 받기"description="에이전트 응답 완료 시 데스크톱 알림."defaultChecked/>
Disabled
비활성
tsx
<Switch label="비활성" disabled />
API
| Name | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | controlled 상태. |
| defaultChecked | boolean | — | uncontrolled 초기값. |
| onCheckedChange | (checked: boolean) => void | — | — |
| label | string | — | 라벨 텍스트 — useId로 자동 연결. |
| description | string | — | 보조 설명. |
| disabled | boolean | false | — |
| ...props | Radix Switch Root props | — | — |