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

55 lines
1.2 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 6
2017-02-04 01:13:35 +08:00
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.
2017-02-13 10:55:53 +08:00
````jsx
2015-12-16 11:53:52 +08:00
import { Tabs, Select } from 'antd';
const TabPane = Tabs.TabPane;
const Option = Select.Option;
class Demo extends React.Component {
state = {
tabPosition: 'top',
}
changeTabPosition = (tabPosition) => {
2015-12-16 11:53:52 +08:00
this.setState({ tabPosition });
}
2015-12-16 11:53:52 +08:00
render() {
return (
<div>
<div style={{ marginBottom: 16 }}>
Tab position
<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>
);
}
}
2015-12-16 11:53:52 +08:00
ReactDOM.render(<Demo />, mountNode);
2015-12-16 11:53:52 +08:00
````