Skip to content
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

Clearing the state of a mantine radio button externally #6102

Closed
1 of 2 tasks
sindrefl opened this issue Apr 18, 2024 · 1 comment
Closed
1 of 2 tasks

Clearing the state of a mantine radio button externally #6102

sindrefl opened this issue Apr 18, 2024 · 1 comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@sindrefl
Copy link

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

7.8.0

What package has an issue?

@mantine/core

What framework do you use?

Vite

In which browsers you can reproduce the issue?

All

Describe the bug

Typing for "value" in Radio.Group is string | undefined, but to be able to clear value through an external element the value must be set to null.
I assume that setting the value to undefined changes the component from controlled to uncontrolled, and keeps the current state internally somehow

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-forked-j8ykns?file=%2Fsrc%2FApp.tsx%3A24%2C72

Possible fix

Easiest fix could be to add null as an option in the types declaration for "value" prop so it does not need to be casted in typescript?

This would make developers more certain that null can be used as a valid value in a radio button group to signal a non-selected, yet controlled value.

Self-service

  • I would be willing to implement a fix for this issue
rtivital added a commit that referenced this issue Apr 23, 2024
@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Apr 23, 2024
@rtivital
Copy link
Member

Fixed in 7.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

2 participants