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

65 lines
1.3 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.
2019-05-07 14:57:32 +08:00
```jsx
2015-12-16 11:53:52 +08:00
import { Tabs, Select } from 'antd';
2018-06-27 15:55:04 +08:00
const { TabPane } = Tabs;
const { Option } = Select;
2015-12-16 11:53:52 +08:00
class Demo extends React.Component {
state = {
tabPosition: 'top',
2019-05-07 14:57:32 +08:00
};
2018-06-27 15:55:04 +08:00
2019-05-07 14:57:32 +08:00
changeTabPosition = tabPosition => {
2015-12-16 11:53:52 +08:00
this.setState({ tabPosition });
2019-05-07 14:57:32 +08:00
};
2018-06-27 15:55:04 +08:00
2015-12-16 11:53:52 +08:00
render() {
return (
<div>
<div style={{ marginBottom: 16 }}>
Tab position
2017-05-15 14:37:22 +08:00
<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}>
2019-05-07 14:57:32 +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);
2019-05-07 14:57:32 +08:00
```