mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 08:59:15 +08:00
e7aa014c31
* docs: init * chore: all types * docs: faq * chore: fix lint
52 lines
1.3 KiB
TypeScript
52 lines
1.3 KiB
TypeScript
import React, { useState } from 'react';
|
|
import type { ConfigProviderProps, RadioChangeEvent } from 'antd';
|
|
import { Radio, Tabs } from 'antd';
|
|
|
|
type SizeType = ConfigProviderProps['componentSize'];
|
|
|
|
const App: React.FC = () => {
|
|
const [size, setSize] = useState<SizeType>('small');
|
|
|
|
const onChange = (e: RadioChangeEvent) => {
|
|
setSize(e.target.value);
|
|
};
|
|
|
|
return (
|
|
<div>
|
|
<Radio.Group value={size} onChange={onChange} style={{ marginBottom: 16 }}>
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
<Radio.Button value="middle">Middle</Radio.Button>
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
</Radio.Group>
|
|
<Tabs
|
|
defaultActiveKey="1"
|
|
size={size}
|
|
style={{ marginBottom: 32 }}
|
|
items={new Array(3).fill(null).map((_, i) => {
|
|
const id = String(i + 1);
|
|
return {
|
|
label: `Tab ${id}`,
|
|
key: id,
|
|
children: `Content of tab ${id}`,
|
|
};
|
|
})}
|
|
/>
|
|
<Tabs
|
|
defaultActiveKey="1"
|
|
type="card"
|
|
size={size}
|
|
items={new Array(3).fill(null).map((_, i) => {
|
|
const id = String(i + 1);
|
|
return {
|
|
label: `Card Tab ${id}`,
|
|
key: id,
|
|
children: `Content of card tab ${id}`,
|
|
};
|
|
})}
|
|
/>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default App;
|