SegmentedControl

One-of-a-few, as a filled track with a sliding thumb.

DayWeekMonth
DayWeekMonth
<SegmentedControl.Root defaultValue="week">
	<SegmentedControl.Item value="day">Day</SegmentedControl.Item>
	<SegmentedControl.Item value="week">Week</SegmentedControl.Item>
	<SegmentedControl.Item value="month">Month</SegmentedControl.Item>
</SegmentedControl.Root>

Always exactly one selected, so it suits a view switcher rather than a filter. Keep it to a handful of short labels — the segments share the width evenly.

API

SegmentedControl.Root

PropTypeDefault
size"default" | "lg" | "sm""default"Control height and label size. Match it to the controls beside it.
stretchbooleanfalseFill the container instead of the labels, each segment taking an equal share of it. For a control that belongs to a column — a settings rail, a form, a phone — where segments sized to their own words leave the control ragged against everything stacked with it.
exitExit—Inside a <Presence>: plays this child's way out before it unmounts.
classNamestring | ((state: RadioGroupState) => string | undefined)—CSS class applied to the element, or a function that returns a class based on the component's state.
defaultValueany—The uncontrolled value of the radio button that should be initially selected. To render a controlled radio group, use the value prop instead.
disabledboolean—Whether the component should ignore user interaction.
formstring—Identifies the form that owns the radio inputs. Useful when the radio group is rendered outside the form.
inputRefRef<HTMLInputElement>—A ref to access the hidden input element.
namestring—Identifies the field when a form is submitted.
onValueChange((value: any, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)—Callback fired when the value changes.
readOnlyboolean—Whether the user should be unable to select a different radio button in the group.
renderComponentRenderFn<HTMLProps, RadioGroupState> | ReactElement<unknown, string | JSXElementConstructor<any>>—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
requiredboolean—Whether the user must choose a value before submitting a form.
styleCSSProperties | ((state: RadioGroupState) => CSSProperties | undefined)—Style applied to the element, or a function that returns a style object based on the component's state.
valueany—The controlled value of the radio item that should be currently selected. To render an uncontrolled radio group, use the defaultValue prop instead.

Plus the DOM props of the element it renders. Source: segmented-control/components/segmented-control-root.tsx.

SegmentedControl.Item

PropTypeDefault
exitExit—Inside a <Presence>: plays this child's way out before it unmounts.
valueanyrequiredThe unique identifying value of the radio in a group.
classNamestring | ((state: RadioRootState) => string | undefined)—CSS class applied to the element, or a function that returns a class based on the component's state.
disabledboolean—Whether the component should ignore user interaction.
inputRefRef<HTMLInputElement>—A ref to access the hidden input element.
nativeButtonboolean—Whether the component renders a native <button> element when replacing it via the render prop. Set to true if the rendered element is a native button.
readOnlyboolean—Whether the user should be unable to select the radio button.
renderComponentRenderFn<HTMLProps, RadioRootState> | ReactElement<unknown, string | JSXElementConstructor<any>>—Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.
requiredboolean—Whether the user must choose a value before submitting a form.
styleCSSProperties | ((state: RadioRootState) => CSSProperties | undefined)—Style applied to the element, or a function that returns a style object based on the component's state.

Plus the DOM props of the element it renders. Source: segmented-control/components/segmented-control-item.tsx.