Debian Codegraph @

node/@patternfly/react-core/src/components/Switch/examples/SwitchBasic.tsx

raw
1 import { useState } from 'react';
2 import { Switch } from '@patternfly/react-core';
3
4 export const SwitchBasic: React.FunctionComponent = () => {
5 const [isChecked, setIsChecked] = useState<boolean>(true);
6
7 const handleChange = (_event: React.FormEvent<HTMLInputElement>, checked: boolean) => {
8 setIsChecked(checked);
9 };
10
11 return (
12 <Switch
13 id="simple-switch"
14 label="Togglable option for basic example"
15 isChecked={isChecked}
16 onChange={handleChange}
17 ouiaId="BasicSwitch"
18 />
19 );
20 };