Radio单选框
Radio
单选框
用于在多个备选项中选中单个状态。
| 使用import{ Radio }from"antd"; | 
| 文档编辑此页 | 
通用属性参考:通用属性
| 参数 | 说明 | 类型 | 默认值 | 
|---|---|---|---|
| autoFocus | 自动获取焦点 | boolean | false | 
| checked | 指定当前是否选中 | boolean | false | 
| defaultChecked | 初始是否选中 | boolean | false | 
| disabled | 禁用 Radio | boolean | false | 
| value | 根据 value 进行比较,判断是否选中 | any | - | 
单选框组合,用于包裹一组 Radio。
| 参数 | 说明 | 类型 | 默认值 | 版本 | 
|---|---|---|---|---|
| buttonStyle | RadioButton 的风格样式,目前有描边和填色两种风格 | outline|solid | outline | |
| defaultValue | 默认选中的值 | any | - | |
| disabled | 禁选所有子单选器 | boolean | false | |
| name | RadioGroup 下所有 input[type="radio"]的name属性 | string | - | |
| options | 以配置形式设置子元素 | string[] | number[] | Array<CheckboxOptionType> | - | |
| optionType | 用于设置 Radio options类型 | default|button | default | 4.4.0 | 
| size | 大小,只对按钮样式生效 | large|middle|small | - | |
| value | 用于设置当前选中的值 | any | - | |
| onChange | 选项变化时的回调函数 | function(e:Event) | - | 
| Property | Description | Type | Default | Version | 
|---|---|---|---|---|
| label | 用于作为 Radio 选项展示的文本 | string | - | 4.4.0 | 
| value | 关联 Radio 选项的值 | string|number|boolean | - | 4.4.0 | 
| style | 应用到 Radio 选项的 style | React.CSSProperties | - | 4.4.0 | 
| disabled | 指定 Radio 选项是否要禁用 | boolean | false | 4.4.0 | 
| title | 添加 Title 属性值 | string | - | 4.4.0 | 
| id | 添加 Radio Id 属性值 | string | - | 4.4.0 | 
| onChange | 当 Radio Group 的值发送改变时触发 | (e: CheckboxChangeEvent) => void; | - | 4.4.0 | 
| required | 指定 Radio 选项是否必填 | boolean | false | 4.4.0 | 
| 名称 | 描述 | 
|---|---|
| blur() | 移除焦点 | 
| focus() | 获取焦点 | 
| Token 名称 | 描述 | 类型 | 默认值 | 
|---|---|---|---|
| buttonBg | 单选框按钮背景色 | string | #ffffff | 
| buttonCheckedBg | 单选框按钮选中背景色 | string | #ffffff | 
| buttonCheckedBgDisabled | 单选框按钮选中并禁用时的背景色 | string | rgba(0, 0, 0, 0.15) | 
| buttonCheckedColorDisabled | 单选框按钮选中并禁用时的文本颜色 | string | rgba(0, 0, 0, 0.25) | 
| buttonColor | 单选框按钮文本颜色 | string | rgba(0, 0, 0, 0.88) | 
| buttonPaddingInline | 单选框按钮横向内间距 | number | 15 | 
| buttonSolidCheckedActiveBg | 单选框实色按钮选中时的激活态背景色 | string | #0958d9 | 
| buttonSolidCheckedBg | 单选框实色按钮选中时的背景色 | string | #1677ff | 
| buttonSolidCheckedColor | 单选框实色按钮选中时的文本颜色 | string | #fff | 
| buttonSolidCheckedHoverBg | 单选框实色按钮选中时的悬浮态背景色 | string | #4096ff | 
| dotColorDisabled | 单选框圆点禁用颜色 | string | rgba(0, 0, 0, 0.25) | 
| dotSize | 单选框圆点大小 | number | 8 | 
| radioSize | 单选框大小 | number | 16 | 
| wrapperMarginInlineEnd | 单选框右间距 | number | 8 |