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: docs/content/Checkbox.mdx
+29-1Lines changed: 29 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The `Checkbox` component can be used in controlled and uncontrolled modes.
45
45
technologies.
46
46
</Note>
47
47
48
-
## Indeterminate
48
+
###Indeterminate
49
49
50
50
An `indeterminate` checkbox state should be used if the input value is neither true nor false. This can be useful in situations where you are required to display an incomplete state, or one that is dependent on other input selections to determine a value.
51
51
@@ -74,6 +74,34 @@ An `indeterminate` checkbox state should be used if the input value is neither t
74
74
</form>
75
75
```
76
76
77
+
### Grouping Checkbox components
78
+
79
+
If you're not building something custom, you should use the [CheckboxGroup](/CheckboxGroup) component to render a group of checkbox inputs.
@@ -161,12 +156,10 @@ description: Use a segmented control to let users select an option from a short
161
156
}`}
162
157
description="Whether the control fills the width of its parent"
163
158
/>
164
-
<PropsTableRowname="loading"type="boolean"description="Whether the selected segment is being calculated" />
165
159
<PropsTableRow
166
160
name="onChange"
167
161
type="(selectedIndex?: number) => void"
168
162
description="The handler that gets called when a segment is selected"
169
-
required
170
163
/>
171
164
<PropsTableRow
172
165
name="variant"
@@ -187,7 +180,16 @@ description: Use a segmented control to let users select an option from a short
187
180
188
181
<PropsTable>
189
182
<PropsTableRowname="leadingIcon"type="Component"description="The leading icon comes before item label" />
190
-
<PropsTableRowname="selected"type="boolean"description="Whether the segment is selected" />
183
+
<PropsTableRow
184
+
name="selected"
185
+
type="boolean"
186
+
description="Whether the segment is selected. This is used for controlled SegmentedControls, and needs to be updated using the onChange handler on SegmentedControl."
187
+
/>
188
+
<PropsTableRow
189
+
name="defaultSelected"
190
+
type="boolean"
191
+
description="Whether the segment is selected. This is used for uncontrolled SegmentedControls to pick one SegmentedControlButton that is selected on the initial render."
192
+
/>
191
193
<PropsTableSxRow />
192
194
<PropsTableRefRowrefType="HTMLButtonElement" />
193
195
</PropsTable>
@@ -202,7 +204,16 @@ description: Use a segmented control to let users select an option from a short
202
204
description="The icon that represents the segmented control item"
203
205
required
204
206
/>
205
-
<PropsTableRowname="selected"type="boolean"description="Whether the segment is selected" />
207
+
<PropsTableRow
208
+
name="selected"
209
+
type="boolean"
210
+
description="Whether the segment is selected. This is used for controlled SegmentedControls, and needs to be updated using the onChange handler on SegmentedControl."
211
+
/>
212
+
<PropsTableRow
213
+
name="defaultSelected"
214
+
type="boolean"
215
+
description="Whether the segment is selected. This is used for uncontrolled SegmentedControls to pick one SegmentedControlButton that is selected on the initial render."
Copy file name to clipboardExpand all lines: src/SegmentedControl/SegmentedControlButton.tsx
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,10 @@ import {getSegmentedControlButtonStyles, getSegmentedControlListItemStyles} from
8
8
exporttypeSegmentedControlButtonProps={
9
9
/** The visible label rendered in the button */
10
10
children: string
11
-
/** Whether the segment is selected */
11
+
/** Whether the segment is selected. This is used for controlled `SegmentedControls`, and needs to be updated using the `onChange` handler on `SegmentedControl`. */
12
12
selected?: boolean
13
+
/** Whether the segment is selected. This is used for uncontrolled `SegmentedControls` to pick one `SegmentedControlButton` that is selected on the initial render. */
0 commit comments