ant-design/components/radio/demo/radiogroup-more.md
2020-03-30 22:14:13 +08:00

60 lines
1.1 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.

---
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 } 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 radioStyle = {
display: 'block',
height: '30px',
lineHeight: '30px',
};
const { value } = this.state;
return (
<Radio.Group onChange={this.onChange} value={value}>
<Radio style={radioStyle} value={1}>
Option A
</Radio>
<Radio style={radioStyle} value={2}>
Option B
</Radio>
<Radio style={radioStyle} value={3}>
Option C
</Radio>
<Radio style={radioStyle} value={4}>
More...
{value === 4 ? <Input style={{ width: 100, marginLeft: 10 }} /> : null}
</Radio>
</Radio.Group>
);
}
}
ReactDOM.render(<App />, mountNode);
```