Radio 单选按钮
使用场景#
单选按钮允许用户从一个数据集中选择单个选项。如果你觉得用户需要并排看到所有的可选项,使用单选按钮进行排他操作。此外,考虑使用下拉列表,相对于显示所有的选项占用更少的空间。
示例#
基本示例#
inline
组合#
无默认值
有默认值
noInline
方向#
noInline
受控#
noInline
API#
Radio#
| 字段 | 描述 |
|---|---|
| name | string所属分组名 |
| value | string分组值 |
| checked | boolean受控选中态 |
| defaultChecked | boolean非受控选中初值 |
| disabled | boolean禁用 |
| readOnly | boolean只读 |
| onChange | (event: ChangeEvent<HTMLInputElement>) => void选中状态变化时的回调 |
| className | string |
RadioGroup#
| 字段 | 描述 |
|---|---|
| name | string分组名,用于当页面存在多个 Group 时进行区分 |
| dataSource | ListNode<string>[]列表 |
| direction | FlexDirection排列方向 |
| value | string |
| defaultValue | string |
| onChange | FormControlOnChangeHandler<string> |
