ant-design/components/radio/demo/radiobutton.md

28 lines
596 B
Markdown
Raw Normal View History

2015-08-21 18:24:09 +08:00
# 按钮样式
- order: 3
按钮样式的单选组合。
---
````jsx
import { Radio } from 'antd';
const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;
2015-08-21 18:24:09 +08:00
function onChange(e) {
console.log('radio checked:' + e.target.value);
}
2015-10-20 16:47:55 +08:00
ReactDOM.render((
2015-08-21 18:24:09 +08:00
<RadioGroup onChange={onChange} defaultValue="a">
2015-08-21 19:16:03 +08:00
<RadioButton value="a">杭州</RadioButton>
<RadioButton value="b">上海</RadioButton>
<RadioButton value="c">北京</RadioButton>
<RadioButton value="d">成都</RadioButton>
2015-08-21 18:24:09 +08:00
</RadioGroup>
), document.getElementById('components-radio-demo-radiobutton'));
````