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

56 lines
1.3 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 6
title:
zh-CN: 位置
en-US: Position
2016-03-31 09:40:55 +08:00
---
2015-12-16 11:53:52 +08:00
2016-08-03 10:39:20 +08:00
## zh-CN
2015-12-16 11:53:52 +08:00
有四个位置,`tabPosition="left|right|top|bottom"`。
2016-08-03 10:39:20 +08:00
## en-US
Tab's position: left, right, top or bottom.
2015-12-16 11:53:52 +08:00
````jsx
import { Tabs, Select } from 'antd';
const TabPane = Tabs.TabPane;
const Option = Select.Option;
const Demo = React.createClass({
getInitialState() {
return {
tabPosition: 'top',
};
},
changeTabPosition(tabPosition) {
this.setState({ tabPosition });
},
render() {
return (
<div>
<div style={{ marginBottom: 16 }}>
页签位置:
<Select value={this.state.tabPosition} onChange={this.changeTabPosition}
dropdownMatchSelectWidth={false}
>
<Option value="top">top</Option>
<Option value="bottom">bottom</Option>
<Option value="left">left</Option>
<Option value="right">right</Option>
</Select>
</div>
<Tabs tabPosition={this.state.tabPosition}>
2016-08-03 10:39:20 +08:00
<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>
2015-12-16 11:53:52 +08:00
</div>
);
2016-05-11 09:32:33 +08:00
},
2015-12-16 11:53:52 +08:00
});
ReactDOM.render(<Demo />, mountNode);
2015-12-16 11:53:52 +08:00
````