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.
Best practices
appearance property | Example | Usage |
|---|---|---|
"solid" | Use for primary or emphasized selections. | |
"outline-fill" | Use for secondary or less-emphasized selections. Consists of text/icons and a border with a background fill. | |
"outline" | Use for secondary or less-emphasized selections. Has no background fill. |
Accessibility
Keyboard navigation
| Key | Function |
|---|---|
Arrow left | Moves 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 right | Moves 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 up | Moves 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 down | Moves 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. |
Tab | Moves focus in and out of component. |
Tab and Shift | Moves focus in and out of component. |
Writing and copy
- Keep text for Segmented Controls simple and succinct
- Avoid using more than two 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
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
| appearance | appearance | Specifies the appearance style of the component. | Extract<"outline" | "outline-fill" | "solid", Appearance> | "solid" |
| disabled | disabled | When | boolean | false |
| form | form | Specifies the When not set, the component is associated with its ancestor form element, if one exists. | string | |
| labelText | label-text | Specifies the component's label text. | string | |
| layout | layout | Defines the layout of the component. | Extract<"horizontal" | "vertical", Layout> | "horizontal" |
| messageOverrides | Overrides individual strings used by the component. | Record<string, unknown> | undefined | ||
| name | name | Specifies the name of the component. Required to pass the component's | string | |
| required | required | When | boolean | false |
| scale | scale | Specifies the size of the component. | Scale | "m" |
| selectedItem | The component's selected item | SegmentedControlItem | ||
| status | status | Specifies the status of the validation message. | Status | "idle" |
| validationIcon | validation-icon | Specifies the validation icon to display under the component. | IconName | boolean | |
| validationMessage | validation-message | Specifies the validation message to display under the component. | string | |
| validity | The component's current validation state. | ValidityState | ||
| value | value | The component's | string | |
| width | width | Specifies the width of the component. [Deprecated] The | Extract<"auto" | "full", Width> | "auto" |
Slots
| Name | Description |
|---|---|
| default (unnamed) | A slot for adding |
| label-content | A slot for rendering content next to the component's |
Styles
| Name | Description |
|---|---|
| --calcite-segmented-control-border-color | Specifies the component's border color. |
Events
| Name | Description | Behavior |
|---|---|---|
| calciteSegmentedControlChange | Fires when the |
Methods
| Name | Description | Signature |
|---|---|---|
| componentOnReady | Creates a promise that resolves once the component is fully loaded. | componentOnReady(): Promise<this> |
| setFocus | Sets focus on the component. | setFocus(options?: FocusOptions): Promise<void> |