Replies: 1 comment
-
This is a design decision. I don't see how this restricts your work. Please share more details on what you're trying to achieve. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🐛 Bug report
I'm noticing that the Checkbox component currently requires a wrapping
<label>
element to toggle its checked state. Because the checkbox itself is visually hidden byapi.getHiddenInputProps()
, it's not clickable on its own. This feels too restrictive, as it's perfectly valid in HTML to place the label elsewhere—as long as thefor
andid
attributes match.💥 Steps to reproduce
<input v-bind="api.getHiddenInputProps()" />
outside of a<label>
.You can see in the [demo](https://zagjs.com/components/vue/checkbox) that a wrapping
<label>
is always used.🧐 Expected behavior
<label>
.for
andid
match, the checkbox should be clickable, even if the label is placed elsewhere.Versions:
@zag-js/checkbox
:^0.82.1
@zag-js/vue
:^0.82.1
Environment:
Thank you for looking into this issue!
Beta Was this translation helpful? Give feedback.
All reactions