| 1 |
--- |
| 2 |
id: Radio |
| 3 |
section: components |
| 4 |
subsection: forms |
| 5 |
cssPrefix: pf-v6-c-radio |
| 6 |
propComponents: ['Radio'] |
| 7 |
ouia: true |
| 8 |
--- |
| 9 |
|
| 10 |
import { Fragment, useState } from 'react'; |
| 11 |
|
| 12 |
## Examples |
| 13 |
|
| 14 |
### Controlled |
| 15 |
|
| 16 |
```ts file="./RadioControlled.tsx" |
| 17 |
|
| 18 |
``` |
| 19 |
|
| 20 |
### Uncontrolled |
| 21 |
|
| 22 |
```ts file="./RadioUncontrolled.tsx" |
| 23 |
|
| 24 |
``` |
| 25 |
|
| 26 |
### Reversed |
| 27 |
|
| 28 |
```ts file="./RadioReversed.tsx" |
| 29 |
|
| 30 |
``` |
| 31 |
|
| 32 |
### Label wraps |
| 33 |
|
| 34 |
You can expand the clickable area of a radio so that it spans wider than the radio label by adding the `isLabelWrapped` property. This allows users to select a radio by clicking the radio itself, the label, or the area between the radio and the label. |
| 35 |
|
| 36 |
```ts file="./RadioLabelWraps.tsx" |
| 37 |
|
| 38 |
``` |
| 39 |
|
| 40 |
### Disabled |
| 41 |
|
| 42 |
```ts file="./RadioDisabled.tsx" |
| 43 |
|
| 44 |
``` |
| 45 |
|
| 46 |
### With description |
| 47 |
|
| 48 |
```ts file="./RadioWithDescription.tsx" |
| 49 |
|
| 50 |
``` |
| 51 |
|
| 52 |
### With body |
| 53 |
|
| 54 |
```ts file="./RadioWithBody.tsx" |
| 55 |
|
| 56 |
``` |
| 57 |
|
| 58 |
### With description and body |
| 59 |
|
| 60 |
```ts file="./RadioWithDescriptionAndBody.tsx" |
| 61 |
|
| 62 |
``` |
| 63 |
|
| 64 |
### Standalone input |
| 65 |
|
| 66 |
```ts file="./RadioStandaloneInput.tsx" |
| 67 |
|
| 68 |
``` |