Skip to content
Discussion options

You must be logged in to vote

Alright, first, I should say that I've never used Headless UI in production, so I'm not aware of all the quirks of the library (which I see many of lol).

Now, the Switch component does expose the ref prop, which doesn't get.. forwarded (?) to the button component that is the default component rendered if not altered via the as prop. I don't have time to actually look into the implementation, sadly.

I've managed to hack together a working example by providing my own button element as a child of the Switch component. I've added as={Fragment} to avoid rendering the default button component Headless UI provides. All the a11y button attributes are propagated to the newly provided button elemen…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@Moshyfawn
Comment options

@nehiro
Comment options

@Moshyfawn
Comment options

@nehiro
Comment options

@Moshyfawn
Comment options

Comment options

You must be logged in to vote
1 reply
@nehiro
Comment options

Answer selected by Moshyfawn
Comment options

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