Skip to Content

Checkbox

체크박스 컨트롤. 클릭으로 선택/해제할 수 있으며, 3단계 순환 모드를 지원한다.


개요

CALS Checkbox는 Foundation Checkbox를 래핑하여 CALS 전용 기능(토큰 오버라이드, FormItem 래핑, 3단계 순환 등)을 제공한다.

주요 특징

  • 기본 선택/해제: 클릭으로 체크 토글
  • 3단계 순환: threeState 모드에서 unchecked→checked→indeterminate 순환
  • 읽기 전용: 상태 표시만 하고 조작 차단
  • 디자인 토큰: Foundation 토큰 시스템 완벽 호환
  • FormItem 래핑: label/required/error 자동 래핑

기본 사용

children으로 라벨 텍스트를 전달한다.


크기

size prop으로 체크박스 크기를 변경한다.


비활성 상태

disabled prop으로 클릭을 차단한다.


읽기 전용

readOnly prop은 클릭을 차단하지만 기존 상태를 유지한다.


3단계 체크박스

threeState prop으로 unchecked→checked→indeterminate 순환을 활성화한다.


FormItem 래핑

label, required, description, error prop을 제공하면 FormItem으로 자동 래핑된다.


커스텀 색상

backgroundColor, color, borderColor prop으로 토큰을 오버라이드한다.


API Reference

Props

PropTypeDefaultDescription
checkedboolean | "indeterminate"-체크 상태 (제어 모드)
defaultCheckedboolean | "indeterminate"-초기 체크 상태 (비제어 모드)
threeStatebooleanfalse3단계 순환 활성화
size"xs" | "sm" | "md" | "lg" | "xl""md"체크박스 크기
visiblebooleantrue표시 여부
disabledboolean-비활성화
readOnlyboolean-읽기 전용
titlestring-HTML title 속성 (네이티브 툴팁)
backgroundColorstring-배경색 + 파생 색상
colorstring-라벨 텍스트 색상
borderColorstring-테두리 색상 + 파생 색상
fontSizestring-라벨 폰트 크기
fontWeightstring | number-라벨 폰트 굵기
fontStylestring-라벨 폰트 스타일
showLabelbooleanfalse빈 레이블 공간 표시
classNamestring-컨테이너에 적용할 CSS 클래스
formClassNamestring-FormItem 래퍼에 적용할 CSS 클래스
styleCSSProperties-인라인 스타일
childrenReactNode-라벨 콘텐츠
labelstring-FormItem 레이블
requiredboolean-FormItem 필수 표시
descriptionstring-FormItem 설명 텍스트
errorstring-FormItem 에러 메시지

Events

EventTypeDescription
onCheckedChange(value: boolean | "indeterminate") => void체크 상태 변경 시 호출

Ref (CheckboxRef)

메서드/속성TypeDescription
focus()() => void체크박스에 포커스
blur()() => void포커스 해제
elementHTMLButtonElement | null내부 요소 참조

접근성

권장 사항

  • ✅ 의미 있는 라벨 텍스트를 children으로 제공
  • ✅ 라벨 없는 체크박스에는 aria-label 사용
  • ✅ 그룹화된 체크박스는 fieldset/legend으로 감싸기
  • ❌ 라벨 없이 체크박스만 사용하지 않기

관련 컴포넌트

Last updated on