Segmented control are used to switch between alternative views of similar or related content.
| Name | Description | Default |
|---|---|---|
| label | Text that's used as the visual and accessible label for the component. If not provided, hide the component's built-in label. string | - |
| aria-labelledby | The id of a label, which provides an accessible name for the component Identifies the element (or elements) that labels the current element. @see aria-describedby. string | - |
| selected | The 'id' value of the SegmentedButton that is currently selected (controlled component) string | - |
| defaultSelected | The 'id' value of the SegmentedButton that should be selected on first mount (uncontrolled component) string | - |
| id* | ID used for accessible labeling string | - |
| children | Children to render as the text for the legend. NonNullable<ReactNode> | - |
| onSelectionChange | The event handler for click events on button, disabled for disabled buttons ((event: MouseEvent<HTMLButtonElement, MouseEvent>, selectedId: string) => void) | - |
| hint | Additional information for the select string | - |
| isHintVisuallyHidden | If true, visually hides the hint text (it will still be accessible to screen readers) boolean | - |
| variant | Determines the style of the selected button in the SegmentedControl. Defaults to 'primary' if not specified. "primary" | "secondary" | - |
| iconPosition | Determines where to position the icon within the SegmentedButton. Defaults to 'start' if not specified. "start" | "end" | start |
| ref | ((instance: HTMLDivElement | null) => void) | RefObject<HTMLDivElement> | null | - |
| disabled | @deprecated use The All DLS components are designed to use the boolean | - |
| aria-disabled | If true, styles component as disabled and prevents interactivity. Screen reader reads as "dimmed" or "disabled". Booleanish | - |
| Name | Description | Default |
|---|---|---|
| disabled | @deprecated use The All DLS components are designed to use the boolean | - |
| aria-disabled | If true, styles component as disabled and prevents interactivity. Screen reader reads as "dimmed" or "disabled". Booleanish | - |
| ref | ((instance: HTMLButtonElement | null) => void) | RefObject<HTMLButtonElement> | null | - |
| children | Contents of button body ReactNode | - |
| onClick | The event handler for click events on button, disabled for disabled buttons MouseEventHandler<HTMLButtonElement> | - |
| isLoading | If true, shows loading button with spinner boolean | - |
| variant | Determines style of button "primary" | "secondary" | "tertiary" | - |
| iconPosition | Place icon before or after text "start" | "end" | - |
| icon | Custom icon displayed in notification ReactNode | - |
| reactlytics | ReactlyticsProp | - |
| labelOverrides | Overrides for labels that have been defaulted in the component. ButtonLabelOverrides | - |
Connect with the DLS Team on Slack or by email.
Check out additional resources.