1. framework components
  2. segmented control

Segmented Control

Capture input for a limited set of options.

Label

Controlled

item-1

Icons

Orientation

API Reference

Root

txt
flex flex-col gap-2 group
PropDefaultType
idsPartial<{ root: string; label: string; indicator: string; item: (value: string) => string; itemLabel: (value: string) => string; itemControl: (value: string) => string; itemHiddenInput: (value: string) => string; }> | undefined

The ids of the elements in the radio. Useful for composition.

valuestring | null | undefined

The controlled value of the radio group

defaultValuestring | null | undefined

The initial value of the checked radio when rendered. Use when you don't need to control the value of the radio group.

namestring | undefined

The name of the input fields in the radio (Useful for form submission).

formstring | undefined

The associate form of the underlying input.

disabledboolean | undefined

If `true`, the radio group will be disabled

readOnlyboolean | undefined

Whether the checkbox is read-only

onValueChange((details: ValueChangeDetails) => void) | undefined

Function called once a radio is checked

orientation"horizontal" | "vertical" | undefined

Orientation of the radio group

dir"ltr""ltr" | "rtl" | undefined

The document's text/writing direction.

getRootNode(() => ShadowRoot | Node | Document) | undefined

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Provider

PropDefaultType
value() => RadioGroupApi<PropTypes>

elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Context

PropDefaultType
childrenSnippet<[() => RadioGroupApi<PropTypes>]>

Label

txt
label-text
PropDefaultType
elementSnippet<[HTMLAttributes<"span">]> | undefined

Render the element yourself

Control

txt
inline-flex preset-outlined-surface-200-800 p-2 gap-2 rounded group-data-[orientation=horizontal]:flex-row group-data-[orientation=vertical]:flex-col
PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Indicator

txt
top-(--top) left-(--left) w-(--width) h-(--height) preset-filled rounded data-disabled:opacity-50
PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Item

txt
btn cursor-pointer z-10 flex-1 data-focus-visible:outline-2 data-focus-visible:outline-offset-1 data-focus-visible:outline-surface-950-50 data-readonly:pointer-events-none data-disabled:pointer-events-none data-disabled:opacity-50
PropDefaultType
valuestring

disabledboolean | undefined

invalidboolean | undefined

elementSnippet<[HTMLAttributes<"label">]> | undefined

Render the element yourself

ItemText

txt
transition-colors data-[state=checked]:text-surface-contrast-950 data-[state=checked]:dark:text-surface-contrast-50
PropDefaultType
elementSnippet<[HTMLAttributes<"span">]> | undefined

Render the element yourself

ItemHiddenInput

PropDefaultType
elementSnippet<[HTMLAttributes<"input">]> | undefined

Render the element yourself

View page on GitHub