Debian Codegraph @

node/@patternfly/react-core/src/components/Checkbox/examples/Checkbox.md

raw
1 ---
2 id: Checkbox
3 section: components
4 subsection: forms
5 cssPrefix: pf-v6-c-check
6 propComponents: ['Checkbox']
7 ---
8
9 import { Fragment, useEffect, useState } from 'react';
10
11 ## Examples
12
13 ### Controlled
14
15 ```ts file='./CheckboxControlled.tsx'
16
17 ```
18
19 ### Uncontrolled
20
21 ```ts file='./CheckboxUncontrolled.tsx'
22
23 ```
24
25 ### Reversed
26
27 ```ts file="./CheckboxReversed.tsx"
28
29 ```
30
31 ### Label wraps
32
33 You can expand the clickable area of a checkbox so that it spans wider than the checkbox label by adding the `isLabelWrapped` property. This allows users to select a checkbox by clicking the checkbox itself, the label, or the area between the checkbox and the label.
34
35 ```ts file="./CheckboxLabelWraps.tsx"
36
37 ```
38
39 ### Disabled
40
41 ```ts file='./CheckboxDisabled.tsx'
42
43 ```
44
45 ### Checkbox with description
46
47 ```ts file='./CheckboxWithDescription.tsx'
48
49 ```
50
51 ### Checkbox with body
52
53 ```ts file='./CheckboxWithBody.tsx'
54
55 ```
56
57 ### Checkbox with description and body
58
59 ```ts file='./CheckboxWithDescriptionBody.tsx'
60
61 ```
62
63 ### Standalone input
64
65 ```ts file='./CheckboxStandaloneInput.tsx'
66
67 ```
68
69 ### Required input
70
71 ```ts file='./CheckboxRequired.tsx'
72
73 ```