Skip to content

react-aria hooks useCheckbox with separate label #6083

Answered by reidbarber
Shadowlauch asked this question in Q&A
Discussion options

You must be logged in to vote

I think this is a case where you'll just want to override typescript.

<div {...labelProps as React.HTMLAttributes<HTMLElement>}>...</div>

labelProps just contains press handlers from usePress, so it should be fine. I would just test your component on a variety of devices, including touch screens and assistive tech, to ensure it still has a good experience. And be sure the input is still labelled via aria-labelledby.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Shadowlauch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants