组件
复选框
支持不确定状态的二元选择控件。
用法
基础
HTML
<bs:bsui-checkbox label="Email me about new releases" defaultChecked="true" />复选框列表
每个复选框都以自己的名称提交,其中一个无法取消勾选。
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 | — |