mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
b9a6b7b578
* demo: update demo * add form * clear * add Select * add * fix style * fix style * fix * revert
24 lines
626 B
TypeScript
24 lines
626 B
TypeScript
import React, { useState } from 'react';
|
|
import { Segmented, Button, Space } 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 (
|
|
<Space direction="vertical">
|
|
<Segmented options={options} />
|
|
<Button type="primary" disabled={moreLoaded} onClick={handleLoadOptions}>
|
|
Load more options
|
|
</Button>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default Demo;
|