import { SegmentedControl } from "@servicetitan/anvil2";
function ExampleComponent() {
return (
<SegmentedControl
selected="level-1"
onChange={(value) => console.log(value)}
size="medium"
fill={false}
>
<SegmentedControl.Segment value="level-1">Level 1</SegmentedControl.Segment>
</SegmentedControl>
); }
SegmentedControl Props
In addition to the props listed below, the SegmentedControl component can accept any valid HTML div props.Set the default value in uncontrolled uses.
Whether or not to fill the available width.
Used to add name to segments for control. If empty, it will auto generate one.
Set the value in controlled uses.
size
"small" | "medium"
default:"medium"
Size of the segmented control.
import { SegmentedControl } from "@servicetitan/anvil2";
function ExampleComponent() {
return (
<SegmentedControl.Segment value="segment-1" icon={MenuIcon}>
Segment Label
</SegmentedControl.Segment>
);
}
SegmentedControl.Segment Props
In addition to the props listed below, the SegmentedControl.Segment component can accept any valid HTML label props.A unique identifier for the segment, used to track the selection state.
Icon to display in the segment (SVGR import).