mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
24 lines
642 B
TypeScript
24 lines
642 B
TypeScript
import React, { useState } from 'react';
|
|
import { Button, Flex, Segmented } from 'antd';
|
|
|
|
const Demo: React.FC = () => {
|
|
const [options, setOptions] = useState(['Daily', 'Weekly', 'Monthly']);
|
|
const [moreLoaded, setMoreLoaded] = useState(false);
|
|
|
|
const handleLoadOptions = () => {
|
|
setOptions((prev) => [...prev, 'Quarterly', 'Yearly']);
|
|
setMoreLoaded(true);
|
|
};
|
|
|
|
return (
|
|
<Flex gap="small" align="flex-start" vertical>
|
|
<Segmented options={options} />
|
|
<Button type="primary" disabled={moreLoaded} onClick={handleLoadOptions}>
|
|
Load more options
|
|
</Button>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default Demo;
|