폼과 선택@neumorphism-ui/checkbox

Checkbox

투명한 native input 위에 뉴모피즘 표면을 겹쳐 폼 제출과 브라우저 접근성을 유지합니다. controlled, uncontrolled, indeterminate 상태와 shadcn식 onCheckedChange를 제공합니다.

@neumorphism-ui/checkbox
Registry JSON

미리보기

설치

설치: checkboxnpx shadcn@latest add @neumorphism-ui/checkbox

CLI가 npm 의존성, base 토큰, utils와 컴포넌트 소스를 순서대로 확인하고 설치합니다.

Registry를 처음 사용한다면 namespace 설정 을 먼저 완료하세요.

사용법

사용법: 설치npx shadcn@latest add @neumorphism-ui/checkbox @neumorphism-ui/label

Import

Checkbox import 코드
import { Checkbox } from "@/components/ui/checkbox"
import { Label } from "@/components/ui/label"

Example

Checkbox 사용 코드
<div className="flex items-center gap-2">
  <Checkbox id="updates" defaultChecked />
  <Label htmlFor="updates">제품 업데이트 받기</Label>
</div>

API 레퍼런스

컴포넌트속성타입기본값설명
Checkboxcheckedboolean | "indeterminate"—controlled 체크 또는 혼합 상태입니다.
CheckboxdefaultCheckedbooleanfalseuncontrolled 초기 체크 상태입니다.
CheckboxonCheckedChange(checked: boolean | "indeterminate") => void—체크 상태가 바뀔 때 호출됩니다.
Checkboxdisabledbooleanfalse입력과 포인터 동작을 비활성화합니다.
Checkboxname / value / requirednative input props—폼 제출에 사용하는 네이티브 checkbox 속성입니다.

접근성

  • 01

    실제 input[type=checkbox]를 사용하므로 폼 제출과 키보드 Space 동작을 유지합니다.

  • 02

    Label의 htmlFor와 Checkbox의 id를 연결하거나 Checkbox를 label 안에 배치합니다.

  • 03

    indeterminate 상태에서는 aria-checked=mixed와 DOM indeterminate 속성이 함께 설정됩니다.