Skip to content

[Radio] "Invalid value for prop value on <button> tag" #1696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
benface opened this issue Apr 9, 2025 · 1 comment · Fixed by #1697
Closed

[Radio] "Invalid value for prop value on <button> tag" #1696

benface opened this issue Apr 9, 2025 · 1 comment · Fixed by #1697
Labels
bug 🐛 Something doesn't work component: radio This is the name of the generic UI component, not the React module!

Comments

@benface
Copy link

benface commented Apr 9, 2025

Bug report

Current behavior

When using an object for the value prop of Radio.Root (as seems to be allowed), it attempts to render that object in the value attribute of the underlying <button> element.

Also, when using the render function prop of Radio.Root, value is part of the passed props (the first argument), and I don't think it should be (regardless of the type), as value may not even be a valid attribute for the element we want to render (e.g. div) – maybe it could be in state though (the second argument)?

Expected behavior

Don't include value in the props that are spread onto the <button> / passed to the render function.

Reproducible example

https://codesandbox.io/p/devbox/currying-wood-qyshll?workspaceId=ws_VCLs2BtBqfm4WA73jXMWhM

The first option's <button> has value="[object Object]" and the second one, which uses the render function, has the same on a <div> element where value is not valid.

Note that the title of this issue is a warning I get in Storybook when the same issue occurs, but I don't get it in CodeSandbox for some reason.

Base UI version

1.0.0-alpha.7

Which browser are you using?

Chrome, Safari, and Firefox

Which OS are you using?

macOS

Which assistive tech are you using (if applicable)?

None

@benface benface added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 9, 2025
@benface
Copy link
Author

benface commented Apr 9, 2025

Oh, this is also an issue on RadioGroup:

Invalid value for prop value on <div> tag.

@benface benface changed the title [Radio] "Invalid value for prop value on <button> tag" [Radio] "Invalid value for prop value on <button> tag" Apr 9, 2025
@atomiks atomiks added bug 🐛 Something doesn't work component: radio This is the name of the generic UI component, not the React module! labels Apr 10, 2025
@mj12albert mj12albert removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: radio This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants