Debian Codegraph @

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

raw
1 import { useState } from 'react';
2 import { Switch } from '@patternfly/react-core';
3
4 export const SwitchCheckedWithLabel: 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 label="Togglable option for check icon example"
14 id="checked-with-label-switch-on"
15 isChecked={isChecked}
16 hasCheckIcon
17 onChange={handleChange}
18 />
19 );
20 };