React

Checkbox

사용자가 하나 이상의 옵션을 선택할 수 있게 해주는 컴포넌트입니다. 목록에서 여러 항목을 선택하거나 약관 동의와 같은 선택적 작업에 사용됩니다.

Installation

npx @seed-design/cli@latest add ui:checkbox

Props

CheckboxGroup

Prop

Type

label?React.ReactNode
indicator?React.ReactNode
showRequiredIndicator?boolean | undefined
description?React.ReactNode
errorMessage?React.ReactNode

Checkbox

Prop

Type

inputProps?React.InputHTMLAttributes<HTMLInputElement> | undefined
rootRef?React.Ref<HTMLLabelElement> | undefined
label?React.ReactNode
disabled?boolean | undefined
invalid?boolean | undefined
required?boolean | undefined
checked?boolean | undefined
defaultChecked?boolean | undefined
onCheckedChange?((checked: boolean) => void) | undefined
indeterminate?boolean | undefined

Checkmark

Prop

Type

Examples

Sizes

Tones and Variants

Brand

Neutral

Indeterminate

Weights

Deprecated Props

weight="default"weight="stronger"는 더 이상 사용되지 않습니다. 대신 weight="regular"weight="bold"를 사용하세요.

Long Label

Disabled

Listening to Value Changes

onCheckedChange를 사용하여 체크박스의 선택 상태 변경을 감지할 수 있습니다.

이벤트를 활용해야 하는 경우 inputProps를 통해 내부 <input> 요소에 직접 이벤트 핸들러를 추가할 수 있습니다.

Use Cases

React Hook Form

Using Checkmark

Checkmark는 독립적인 체크 마크 컴포넌트로, Checkbox Primitive 컴포넌트와 조합하여 커스텀 레이아웃을 위해 사용할 수 있습니다.

Fieldset Integration

CheckboxGroup을 사용하여 여러 체크박스를 그룹화하고 label, description, errorMessage 등의 Fieldset 관련 prop을 사용할 수 있습니다.

Last updated on

On this page