企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 多选和单选框 多选框(checkbox)用于选择列表中的一个或多个选项,而单选框(radio)用于从多个选项中只选择一个。 Disabled checkboxes and radios are supported, but to provide a "not-allowed" cursor on hover of the parent`<label>`, you'll need to add the`.disabled`class to the parent`.radio`,`.radio-inline`,`.checkbox`, or`.checkbox-inline`. #### 默认外观(堆叠在一起) ![](https://img.kancloud.cn/2d/8e/2d8ec558a375994e1cdcb7f794addbd4_847x238.png) ~~~html <div class="checkbox"> <label> <input type="checkbox" value=""> Option one is this and that&mdash;be sure to include why it's great </label> </div> <div class="checkbox disabled"> <label> <input type="checkbox" value="" disabled> Option two is disabled </label> </div> <div class="radio"> <label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked> Option one is this and that&mdash;be sure to include why it's great </label> </div> <div class="radio"> <label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2"> Option two can be something else and selecting it will deselect option one </label> </div> <div class="radio disabled"> <label> <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3" disabled> Option three is disabled </label> </div> ~~~ #### 内联单选和多选框 通过将`.checkbox-inline`或`.radio-inline`类应用到一系列的多选框(checkbox)或单选框(radio)控件上,可以使这些控件排列在一行。 ![](https://img.kancloud.cn/ac/a1/aca1f0a14302fc4009f0e3197c3c5b88_848x121.png) ~~~html <label class="checkbox-inline"> <input type="checkbox" id="inlineCheckbox1" value="option1"> 1 </label> <label class="checkbox-inline"> <input type="checkbox" id="inlineCheckbox2" value="option2"> 2 </label> <label class="checkbox-inline"> <input type="checkbox" id="inlineCheckbox3" value="option3"> 3 </label> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> 1 </label> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> 2 </label> <label class="radio-inline"> <input type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3"> 3 </label> ~~~ #### 不带label文本的Checkbox 和 radio 如果需要`<label>`内没有文字,输入框(input)正是你所期望的。**目前只适用于非内联的 checkbox 和 radio。**请记住,仍然需要为使用辅助技术的用户提供某种形式的 label(例如,使用`aria-label`)。 ![](https://img.kancloud.cn/57/8a/578a2a23885d478421e9687268e0e1d0_847x136.png) ~~~html <div class="checkbox"> <label> <input type="checkbox" id="blankCheckbox" value="option1" aria-label="..."> </label> </div> <div class="radio"> <label> <input type="radio" name="blankRadio" id="blankRadio1" value="option1" aria-label="..."> </label> </div> ~~~