tailwindlabs / headlessui

Completely unstyled, fully accessible UI components, designed to integrate beautifully with Tailwind CSS.
https://headlessui.com
MIT License
25.81k stars 1.07k forks source link

Can't use boolean values in `RadioGroup` #3435

Open notfelineit opened 1 month ago

notfelineit commented 1 month ago

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v2.1.2

What browser are you using?

Chrome

Reproduction URL

https://github.com/notfelineit/bug-reproduction/blob/main/README.md

Describe your issue We upgraded from v1 to v2 recently and one of our forms broke. We can't use a boolean type value in RadioGroup, because if the value is false, RadioGroup ends up defaulting to 'on': https://github.com/tailwindlabs/headlessui/blob/main/packages/%40headlessui-react/src/components/radio-group/radio-group.tsx#L320

We got around this by using a string instead, but I'm filing an issue in case other people run into this.

Here's a simple example:

https://github.com/user-attachments/assets/ee561df6-f47e-4a39-bc9d-e5bde34d6e23

notfelineit commented 1 month ago

The ask is to clarify this in the docs, or make it so that we can use boolean values in RadioGroup.