Installation
bash
npx axis-cli add switchUsage
tsx
import { Label, Switch } from '@axis-ds/ui-react'
export function Example() {
return (
<div className="flex items-center space-x-2">
<Switch id="airplane-mode" />
<Label htmlFor="airplane-mode">비행기 모드</Label>
</div>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | - | 활성화 상태 (controlled) |
defaultChecked | boolean | - | 기본 활성화 상태 |
onCheckedChange | (checked: boolean) => void | - | 상태 변경 콜백 |
disabled | boolean | false | 비활성화 여부 |
required | boolean | false | 필수 입력 여부 |
name | string | - | 폼 필드 이름 |
value | string | "on" | 폼 제출 값 |
checkedType:
booleanDefault:
-활성화 상태 (controlled)
defaultCheckedType:
booleanDefault:
-기본 활성화 상태
onCheckedChangeType:
(checked: boolean) => voidDefault:
-상태 변경 콜백
disabledType:
booleanDefault:
false비활성화 여부
requiredType:
booleanDefault:
false필수 입력 여부
nameType:
stringDefault:
-폼 필드 이름
valueType:
stringDefault:
"on"폼 제출 값