ant-design/components/tabs/demo/size.md

46 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 5
2016-09-01 18:12:12 +08:00
title:
2017-10-18 21:17:18 +08:00
zh-CN: 大小
en-US: Size
2016-03-31 09:40:55 +08:00
---
2015-06-19 17:26:24 +08:00
2016-08-03 10:39:20 +08:00
## zh-CN
2017-10-18 21:17:18 +08:00
大号页签用在页头区域,小号用在弹出框等较狭窄的容器内。
2015-06-19 17:26:24 +08:00
2016-08-03 10:39:20 +08:00
## en-US
2017-10-18 21:17:18 +08:00
Large size tabs are usally used in page header, and small size could be used in Modal.
2016-08-03 10:39:20 +08:00
2017-02-13 10:55:53 +08:00
````jsx
2017-10-18 21:17:18 +08:00
import { Tabs, Radio } from 'antd';
const { TabPane } = Tabs;
2015-06-19 17:26:24 +08:00
2017-10-18 21:17:18 +08:00
class Demo extends React.Component {
state = { size: 'small' };
onChange = (e) => {
this.setState({ size: e.target.value });
}
render() {
const { size } = this.state;
return (
<div>
<Radio.Group value={size} onChange={this.onChange} style={{ marginBottom: 16 }}>
<Radio.Button value="small">Small</Radio.Button>
<Radio.Button value="default">Default</Radio.Button>
<Radio.Button value="large">Large</Radio.Button>
</Radio.Group>
<Tabs defaultActiveKey="1" size={size}>
<TabPane tab="Tab 1" key="1">Content of tab 1</TabPane>
<TabPane tab="Tab 2" key="2">Content of tab 2</TabPane>
<TabPane tab="Tab 3" key="3">Content of tab 3</TabPane>
</Tabs>
</div>
);
}
}
ReactDOM.render(<Demo />, mountNode);
2015-06-19 17:26:24 +08:00
````