Can I use SegmentedControl with initial empty value?
SegmentedControl cannot be used without a value.
It is based on FloatingIndicator and requires a value to work properly.
If neither value
nor defaultValue
is provided, SegmentedControl
will automatically set first item as active.
Can I deselect value in SegmentedControl?
No, SegmentedControl
is designed to always have a value.
This constraint is required for the component animations and floating indicator to work properly.
What should I use instead if I need deselect functionality?
If you need to have a control that can be deselected, consider using Radio or Checkbox components.
Both Radio
and Checkbox
can be deselected by setting checked={false}
prop.
I want a component that looks like SegmentedControl but can be deselected
You can build a custom component that works similar to SegmentedControl
with FloatingIndicator.