mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 17:09:46 +08:00
7c2c49316b
* fix: checkbox & radio in flex align * rm only md * docs: Update doc * test: Update snapshot
51 lines
985 B
Markdown
51 lines
985 B
Markdown
---
|
||
order: 2
|
||
title:
|
||
zh-CN: Radio.Group 垂直
|
||
en-US: Vertical Radio.Group
|
||
---
|
||
|
||
## zh-CN
|
||
|
||
垂直的 Radio.Group,配合更多输入框选项。
|
||
|
||
## en-US
|
||
|
||
Vertical Radio.Group, with more radios.
|
||
|
||
```jsx
|
||
import { Radio, Input, Space } from 'antd';
|
||
|
||
class App extends React.Component {
|
||
state = {
|
||
value: 1,
|
||
};
|
||
|
||
onChange = e => {
|
||
console.log('radio checked', e.target.value);
|
||
this.setState({
|
||
value: e.target.value,
|
||
});
|
||
};
|
||
|
||
render() {
|
||
const { value } = this.state;
|
||
return (
|
||
<Radio.Group onChange={this.onChange} value={value}>
|
||
<Space direction="vertical">
|
||
<Radio value={1}>Option A</Radio>
|
||
<Radio value={2}>Option B</Radio>
|
||
<Radio value={3}>Option C</Radio>
|
||
<Radio value={4}>
|
||
More...
|
||
{value === 4 ? <Input style={{ width: 100, marginLeft: 10 }} /> : null}
|
||
</Radio>
|
||
</Space>
|
||
</Radio.Group>
|
||
);
|
||
}
|
||
}
|
||
|
||
ReactDOM.render(<App />, mountNode);
|
||
```
|