mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 04:48:02 +08:00
2cdf586291
* chore: fix lint * chore: fix lint * test: fix 16 * fix: lint
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
import React, { useState } from 'react';
|
|
import type { RadioChangeEvent } from 'antd';
|
|
import { Radio, Space, Tabs } from 'antd';
|
|
|
|
type TabPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
|
|
const App: React.FC = () => {
|
|
const [tabPosition, setTabPosition] = useState<TabPosition>('left');
|
|
|
|
const changeTabPosition = (e: RadioChangeEvent) => {
|
|
setTabPosition(e.target.value);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Space style={{ marginBottom: 24 }}>
|
|
Tab position:
|
|
<Radio.Group value={tabPosition} onChange={changeTabPosition}>
|
|
<Radio.Button value="top">top</Radio.Button>
|
|
<Radio.Button value="bottom">bottom</Radio.Button>
|
|
<Radio.Button value="left">left</Radio.Button>
|
|
<Radio.Button value="right">right</Radio.Button>
|
|
</Radio.Group>
|
|
</Space>
|
|
<Tabs
|
|
tabPosition={tabPosition}
|
|
items={new Array(3).fill(null).map((_, i) => {
|
|
const id = String(i + 1);
|
|
return {
|
|
label: `Tab ${id}`,
|
|
key: id,
|
|
children: `Content of Tab ${id}`,
|
|
};
|
|
})}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|