ant-design/components/switch/demo/disabled.tsx
lijianan d549964493
demo: update demo ()
* demo: update demo

* add

* fix lint
2023-01-18 19:20:40 +08:00

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;