본문으로 건너뛰기

구성 요소

체크박스

불확정 상태도 지원하는 이진 선택 컨트롤입니다.

사용법

기본

HTML
<bs:bsui-checkbox label="Email me about new releases" defaultChecked="true" />

체크박스 목록

각 체크박스는 자체 name으로 제출되며, 그중 하나는 선택 해제할 수 없습니다.

HTML
<bs:bsui-stack direction="column" gap="3">
  <bs:bsui-checkbox name="deploys" label="A deploy finishes" defaultChecked="true" />
  <bs:bsui-checkbox name="failures" label="A build fails" defaultChecked="true" />
  <bs:bsui-checkbox name="mentions" label="Someone mentions me" />
  <bs:bsui-checkbox name="receipts" label="Billing receipts" defaultChecked="true" disabled="true" />
</bs:bsui-stack>

일부 선택

하위의 모든 범위가 선택될 때까지 상위 체크박스는 일부만 선택된 상태를 나타냅니다.

HTML
<bs:bsui-stack direction="column" gap="3">
  <bs:bsui-checkbox label="All repository scopes" indeterminate="true" />
  <bs:bsui-checkbox name="read" label="Read code and issues" defaultChecked="true" />
  <bs:bsui-checkbox name="write" label="Push commits" />
</bs:bsui-stack>

잘못된 상태

체크박스에도 다른 컨트롤처럼 필드에서 오류 메시지를 전달할 수 있습니다.

Accept the terms to continue.
HTML
<bs:bsui-field invalid="true">
  <bs:bsui-checkbox name="terms" label="I agree to the terms of service" />
  <bs:bsui-field-error text="Accept the terms to continue." />
</bs:bsui-field>

속성

속성유형기본값
defaultChecked toggle false
indeterminate toggle false
disabled toggle false
name text —
value text on
label richtext —
bindText text —
nameAlt text —
onChange text —
checked text —