ant-design/components/radio/index.zh-CN.md
偏右 882cec62d6
docs: 🌈 Add Components overview page (#24491)
* docs: Add components overview page

* fix detail

* remove ContributorsList form overview page

* fix components url

* improve code style

* remove extra file

* fix detail

* fix lint

* fix lint

* docs: Finish components overview page

* fix lint

* docs: Update cover

* fix lint

* update cover

* update menu

* improve overview page

* refactor code

* fix order

* update title

* add components count

* fix overview page ssr bug

* move less file

* update title margin

Co-authored-by: arvinxx <arvinx@foxmail.com>
2020-05-31 11:48:34 +08:00

51 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
category: Components
subtitle: 单选框
type: 数据录入
title: Radio
cover: https://gw.alipayobjects.com/zos/alicdn/jhSTlg4WQ/Radio.svg
---
单选框。
## 何时使用
- 用于在多个备选项中选中单个状态。
- 和 Select 的区别是Radio 所有选项默认可见,方便用户在比较中选择,因此选项不宜过多。
## API
### Radio/Radio.Button
| 参数 | 说明 | 类型 | 默认值 |
| -------------- | --------------------------------- | ------- | ------ |
| autoFocus | 自动获取焦点 | boolean | false |
| checked | 指定当前是否选中 | boolean | false |
| defaultChecked | 初始是否选中 | boolean | false |
| disabled | 禁用 Radio | boolean | false |
| value | 根据 value 进行比较,判断是否选中 | any | |
### RadioGroup
单选框组合,用于包裹一组 `Radio`
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| defaultValue | 默认选中的值 | any | |
| disabled | 禁选所有子单选器 | boolean | false |
| name | RadioGroup 下所有 `input[type="radio"]``name` 属性 | string | |
| options | 以配置形式设置子元素 | string\[] \| Array&lt;{ label: string value: string disabled?: boolean }> | |
| size | 大小,只对按钮样式生效 | `large` \| `middle` \| `small` | 无 |
| value | 用于设置当前选中的值 | any | |
| onChange | 选项变化时的回调函数 | Function(e:Event) | |
| buttonStyle | RadioButton 的风格样式,目前有描边和填色两种风格 | `outline` \| `solid` | `outline` |
## 方法
### Radio
| 名称 | 描述 |
| ------- | -------- |
| blur() | 移除焦点 |
| focus() | 获取焦点 |