Segmented Control is a single-choice selector in the form of rectangular visuals.

Overview

Functionality is similar to Radio Button Group, but is visually more prominent.

Sample

Usage

  • Need for more visual prominence than Radio Button Group
  • Workflow view switching
  • Single-choice interactions in forms

Component comparison

Segmented Control, Radio Button Group, and Checkboxes all support selection, but serve different needs.

Segmented ControlThis component
Best for choosing one option from a group of two or more related options. Preferred for visual emphasis, custom styling, or icon support.
Allows only one option to be selected. Selection cannot be cleared.
Radio Button GroupAlternative
Best for choosing one option from a group of two or more related options.
Allows only one option to be selected. Selection cannot be cleared.
CheckboxAlternative
Best for boolean choices when used individually, or for selecting multiple options using separate checkboxes.
Allows each option to be selected or unselected.

Best practices

appearance propertyExampleUsage
"solid"Segmented Control with appearance set to solid, showing the selected item with a filled background for primary selections.Use for primary or emphasized selections.
"outline-fill"Segmented Control with appearance set to outline-fill, using text or icons with a border and background fill for secondary selections.Use for secondary or less-emphasized selections. Consists of text/icons and a border with a background fill.
"outline"Segmented Control with appearance set to outline, showing bordered items without background fill for secondary selections.Use for secondary or less-emphasized selections. Has no background fill.
Segmented Control with Map selected. Other options include Histogram, Table, and HTML.
Do use Segmented Controls to switch among workflow choices.
Segmented Control used as page navigation, which should be avoided.
Avoid using Segmented Controls as page navigation. Consider using Navigation instead.

Accessibility

Keyboard navigation

KeyFunction
Arrow leftMoves focus and selection to previous calcite-segmented-control-item. If the current focus and selection is the first calcite-segmented-control-item, the focus and selection will cycle to the last calcite-segmented-control-item.
Arrow rightMoves focus and selection to next calcite-segmented-control-item. If the current focus and selection is the last calcite-segmented-control-item, the focus and selection will cycle to the first calcite-segmented-control-item.
Arrow upMoves focus and selection to previous calcite-segmented-control-item. If the current focus and selection is the first calcite-segmented-control-item, the focus and selection will cycle to the last calcite-segmented-control-item.
Arrow downMoves focus and selection to next calcite-segmented-control-item. If the current focus and selection is the last calcite-segmented-control-item, the focus and selection will cycle to the first calcite-segmented-control-item.
TabMoves focus in and out of component.
Tab and ShiftMoves focus in and out of component.

Writing and copy

  • Keep text for Segmented Controls simple and succinct
  • Avoid using more than 1-2 words in each item
  • Do not use punctuation like commas or periods in Segmented Control text
  • Do not use contractions, such as "you're", "aren't", "can't", and "haven't" to reduce confusion
  • Avoid writing Segmented Control text as questions
  • Recommended character maximum for each calcite-segmented-control-item: 20

API reference

Properties

PropertyAttributeDescriptionTypeDefault
appearanceappearanceSpecifies the appearance style of the component.Extract<"outline" | "outline-fill" | "solid", Appearance>"solid"
disableddisabledWhen true, interaction is prevented and the component is displayed with lower opacity.booleanfalse
formformSpecifies the id of the component's associated form. When not set, the component is associated with its ancestor form element, if one exists.string
labelTextlabel-textSpecifies the component's label text.string
layoutlayoutDefines the layout of the component.Extract<"horizontal" | "vertical", Layout>"horizontal"
messageOverridesOverrides individual strings used by the component.Record<string, unknown> | undefined
namenameSpecifies the name of the component. Required to pass the component's value on form submission.string
requiredrequiredWhen true and the component resides in a form, the component must have a value in order for the form to submit.booleanfalse
scalescaleSpecifies the size of the component.Scale"m"
selectedItemread-onlyThe component's selected item HTMLElement.SegmentedControlItem
statusstatusSpecifies the status of the validation message.Status"idle"
validationIconvalidation-iconSpecifies the validation icon to display under the component.IconName | boolean
validationMessagevalidation-messageSpecifies the validation message to display under the component.string
validityread-onlyThe component's current validation state.ValidityState
valuevalueThe component's selectedItem value.string
widthwidthSpecifies the width of the component. [Deprecated] The "half" value is deprecated, use "full" instead.Extract<"auto" | "full", Width>"auto"

Slots

NameDescription
default (unnamed)A slot for adding calcite-segmented-control-items.
label-contentA slot for rendering content next to the component's labelText.

Styles

NameDescription
--calcite-segmented-control-border-colorSpecifies the component's border color.

Events

NameDescriptionBehavior
calciteSegmentedControlChangeFires when the calcite-segmented-control-item selection changes.bubblescomposed

Methods

NameDescriptionSignature
componentOnReadyCreates a promise that resolves once the component is fully loaded.componentOnReady(): Promise<this>
setFocusSets focus on the component.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.