[@mantine/core] Allow value reset in SegmentedControl #5689
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently it's not possible to deselect/reset the value of the
SegmentedControl
. You can start out with an empty value, if you take for instance the empty string as value and make sure that in thedata
property it doesn't map to anything. If however you then select a value, and then change the value state back to the empty string, theSegmentedControl
will still visually show your last selected value to be selected (howeverdata-selected=true
will no longer be present).My PR here fixes this behavior and allows you, with a controlled value, to make the component unselected / without anything selected.