Skip to main content

Segmented Controls

A component enabling the user to make a choice among a set of mutually exclusive options.

Code Example

import {
Glass,
SegmentedControl,
SegmentedControlButton,
} from "@coconut-xr/apfel-kruemel";

export default function SegmentedControl() {
return (
<SegmentedControl defaultValue={1}>
<SegmentedControlButton value={1}>
<Text>Label</Text>
</SegmentedControlButton>
<SegmentedControlButton value={2}>
<Text>Label</Text>
</SegmentedControlButton>
<SegmentedControlButton value={3}>
<Text>Label</Text>
</SegmentedControlButton>
<SegmentedControlButton value={4}>
<Text>Long Label</Text>
</SegmentedControlButton>
<SegmentedControlButton value={5} disabled>
<Text>Disabled</Text>
</SegmentedControlButton>
</SegmentedControl>
);
}

Sandbox

Params

Segmented Control

NameTypeAttributesDescription
valueToptionalThe current selected segment of the segmented control
defaultValueToptionalThe default selected segment of the segemented control
onValueChange(value: T) => voidoptionalCallback that is fired when the user selects a new segment
disabledbooleanoptional / default: falseIf true, disable all interactions for the segemented control

Segmented Controll Button

NameTypeAttributesDescription
valueT-The current value of the segmented control button
disabledbooleanoptional / default: falseIf true, disable all interactions for the segemented control button