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
docs(Checkbox): restructure page to match component docs spec
Reorder sections to Usage → Anatomy → Examples → Recipes → Accessibility → FAQ,
rewrite Form Integration recipe to correctly describe the auto-render behavior
of Checkbox.Root's name prop, add Styling with Data Attributes recipe, and add
a FAQ section.
Use `Checkbox.SelectAll` within a group for "select all" patterns. It automatically reflects the group's aggregate state and toggles all items on click:
132
+
### Styling with Data Attributes
128
133
129
-
::: example
130
-
/components/checkbox/indeterminate
134
+
`Checkbox.Root` exposes data attributes for CSS styling without conditional classes:
131
135
132
-
### Indeterminate / Select All
136
+
| Attribute | Values | Notes |
137
+
|-----------|--------|-------|
138
+
|`data-state`|`checked`, `unchecked`, `indeterminate`| Reflects current visual state |
139
+
|`data-disabled`|`true`| Present only when disabled |
133
140
134
-
A "select all" checkbox with tri-state behavior (checked, unchecked, indeterminate) over nested items.
135
-
136
-
:::
137
-
138
-
The `SelectAll` component:
139
-
- Binds to the group's `isAllSelected` and `isMixed` state
140
-
- Calls `toggleAll` on click
141
-
- Does NOT register as a group item
142
-
- Sets `aria-checked="mixed"` and `data-state="indeterminate"` when partially selected
@@ -164,4 +169,24 @@ For custom implementations, use `renderless` mode and bind the `attrs` slot prop
164
169
</template>
165
170
```
166
171
172
+
::: faq
173
+
174
+
??? How do I disable a checkbox?
175
+
176
+
Pass the `disabled` prop on `Checkbox.Root`. The component sets `aria-disabled`, removes `tabindex`, ignores click and Space key events, and exposes `data-disabled="true"` for styling.
177
+
178
+
??? Why does my form submission miss the checkbox value?
179
+
180
+
`Checkbox.Root` only renders the hidden native input when a `name` prop is set. Without `name`, the checkbox is purely visual and won't appear in `FormData`. Add `name="myField"` (and optionally `value`) to participate in form submission.
181
+
182
+
??? How does Checkbox.Group differ from a RadioGroup?
183
+
184
+
`Checkbox.Group` is a multi-selection container — its v-model is an array of selected values, and individual checkboxes can be in an indeterminate state via `Checkbox.SelectAll`. A radio group is single-selection — exactly one option is active and v-model holds a single value.
185
+
186
+
??? Can I use Checkbox.Root without the Indicator subcomponent?
187
+
188
+
Yes. `Checkbox.Indicator` is purely cosmetic — it reads checkbox state from context to render a checkmark. You can omit it entirely and render your own visual using the `attrs` slot prop on `Checkbox.Root`, or use `renderless` mode for full control over the rendered element.
0 commit comments