You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/checkbox.md
+60-7
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
PCR's Checkbox is a simple and small accessible checkbox implementation that's flexible.
4
4
5
-
###Usage
5
+
## Usage
6
6
7
7
Checkbox receives props as [controlled inputs](https://reactjs.org/docs/forms.html), such as `checked` and `onChange`. Basic controlled usage can be seen below:
8
8
@@ -27,7 +27,7 @@ function App() {
27
27
}
28
28
```
29
29
30
-
####`useCheckboxState`
30
+
### `useCheckboxState`
31
31
32
32
To make things easier, there's also the `useCheckboxState` hook which takes care of connecting the checkbox and state together.
33
33
@@ -50,7 +50,7 @@ function App() {
50
50
}
51
51
```
52
52
53
-
### Using icons
53
+
### Using `icon`
54
54
55
55
Using a custom icon instead of the pretty checkbox default is easy. Use the `icon` prop and pass in your own JSX. Supported types are:
56
56
@@ -73,39 +73,80 @@ function App() {
73
73
}
74
74
```
75
75
76
-
### Specifying shape
76
+
### Specifying `shape`
77
77
78
78
Use the `shape` prop to control the shape of the checkbox. Supported values are:
You can programmatically set checkbox value as `indeterminate`:
119
+
You can programmatically set checkbox value as `indeterminate`. This can best be illustrated by an example on the [reakit docs](https://reakit.io/docs/checkbox/#indeterminate-state).
*`state` - `boolean | any[] | "indeterminate"` - Stores the state of the checkbox. Use an array of multiple checkboxes need to to share the same state value. See the [indeterminate state example](checkbox.md#indeterminate-state) for more info.
201
+
202
+
### `Checkbox`
155
203
204
+
| Name | Type | Required | Initial Value | Description |
0 commit comments