node/@patternfly/react-core/src/components/Radio/examples/RadioControlled.tsx
raw| 1 | import { Fragment, useState } from 'react'; |
| 2 | import { Radio } from '@patternfly/react-core'; |
| 3 | |
| 4 | export const RadioControlled: React.FunctionComponent = () => { |
| 5 | const [check1, setCheck1] = useState(false); |
| 6 | |
| 7 | const handleChange = () => { |
| 8 | setCheck1(true); |
| 9 | }; |
| 10 | return ( |
| 11 | <Fragment> |
| 12 | <Radio |
| 13 | isChecked={check1} |
| 14 | name="radio-1" |
| 15 | onChange={handleChange} |
| 16 | label="Controlled Radio" |
| 17 | id="radio-controlled" |
| 18 | ></Radio> |
| 19 | </Fragment> |
| 20 | ); |
| 21 | }; |