구성 요소
스위치
설정을 즉시 적용하고 전환합니다.
사용법
기본
HTML
<bs:bsui-switch label="Email notifications" defaultChecked="true" />환경설정
스위치는 즉시 적용되므로 목록에 저장 버튼이 필요하지 않습니다.
HTML
<bs:bsui-stack direction="column" gap="4">
<bs:bsui-switch name="deploys" label="Deploy summaries" defaultChecked="true" />
<bs:bsui-switch name="failures" label="Build failures" defaultChecked="true" />
<bs:bsui-switch name="news" label="Product news" />
</bs:bsui-stack>읽기 전용 및 비활성화
읽기 전용 스위치는 값을 표시한 채 전환을 막습니다. 비활성화된 스위치는 흐리게 표시됩니다.
HTML
<bs:bsui-stack direction="column" gap="4">
<bs:bsui-switch label="Two factor authentication" defaultChecked="true" readOnly="true" />
<bs:bsui-switch label="Single sign-on" disabled="true" />
</bs:bsui-stack>사용자 지정 값
켜짐 및 꺼짐 상태에 on과 빈 값뿐 아니라 어떤 값이든 제출할 수 있습니다.
Submits weekly while it is on and never while it is off.
HTML
<bs:bsui-field>
<bs:bsui-field-label text="Digest emails" />
<bs:bsui-switch name="digest" label="Send a weekly digest" checkedValue="weekly" uncheckedValue="never" defaultChecked="true" />
<bs:bsui-field-description text="Submits weekly while it is on and never while it is off." />
</bs:bsui-field>구조
스위치의 구성 블록은 아래와 같습니다. 각 블록은 별도의 블록이며 부모 블록 안에서만 렌더링됩니다.
bsui/switchbsui/switch-thumb
속성
| 속성 | 유형 | 기본값 |
|---|---|---|
defaultChecked | toggle | false |
disabled | toggle | false |
readOnly | toggle | false |
required | toggle | false |
name | text | — |
checkedValue | text | on |
uncheckedValue | text | — |
label | richtext | — |
bindText | text | — |
nameAlt | text | — |
onChange | text | — |
checked | text | — |
bsui/switch-thumb
이 블록은 속성을 받지 않습니다.