Debian Codegraph @

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

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