mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 23:18:36 +08:00
d549964493
* demo: update demo * add * fix lint
22 lines
453 B
TypeScript
22 lines
453 B
TypeScript
import React, { useState } from 'react';
|
|
import { Button, Space, Switch } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [disabled, setDisabled] = useState(true);
|
|
|
|
const toggle = () => {
|
|
setDisabled(!disabled);
|
|
};
|
|
|
|
return (
|
|
<Space direction="vertical">
|
|
<Switch disabled={disabled} defaultChecked />
|
|
<Button type="primary" onClick={toggle}>
|
|
Toggle disabled
|
|
</Button>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default App;
|