mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
977f4da9df
* type: add Tab type * add notes * update demo code
30 lines
556 B
TypeScript
30 lines
556 B
TypeScript
import React from 'react';
|
|
import { Tabs } from 'antd';
|
|
import type { TabsProps } from 'antd';
|
|
|
|
const onChange = (key: string) => {
|
|
console.log(key);
|
|
};
|
|
|
|
const items: TabsProps['items'] = [
|
|
{
|
|
key: '1',
|
|
label: `Tab 1`,
|
|
children: `Content of Tab Pane 1`,
|
|
},
|
|
{
|
|
key: '2',
|
|
label: `Tab 2`,
|
|
children: `Content of Tab Pane 2`,
|
|
},
|
|
{
|
|
key: '3',
|
|
label: `Tab 3`,
|
|
children: `Content of Tab Pane 3`,
|
|
},
|
|
];
|
|
|
|
const App: React.FC = () => <Tabs defaultActiveKey="1" items={items} onChange={onChange} />;
|
|
|
|
export default App;
|