Tabs

Tabs consist of two parts- a tab and a tab panel. A tab is a label that represents the content of a tab panel. A tab panel is a region that contains the content associated with a tab. Use tabs to allow users to navigate easily between related views (content in tab panels) within the same context. 

Import

Tabs

Loading preview
Open in Storybook

Automatic Activation Overflow

Loading preview
Open in Storybook

Manual Activation Overflow

Loading preview
Open in Storybook

Uncontained Tabs

Loading preview
Open in Storybook

Props

Tabs Props

NameDescriptionDefault
defaultSelectedTabId

The default tab id to be selected when the component is first rendered (uncontrolled mode)

string
-
selectedTabId

The tab id to be selected (controlled mode)

string
-
onSelectedTabIdChange

A function that's called when the selected tab changes (controlled mode)

((event: KeyboardEvent<HTMLButtonElement> | MouseEvent<HTMLButtonElement, MouseEvent>, id: string) => void)
-
activationType

Determine if tabs are automatically selected and their panel displayed when they receive focus. Manual activation requires user to activate tab by pressing the Space or Enter key

"manual" | "automatic"
automatic
iconPosition

Specifies the position of the icon relative to the tab label

"top" | "start"
start
showInContainer

When set to true, the tabs container has padding around the tab list and tab panel

boolean
true

TabList Props

NameDescriptionDefault
previousScrollButtonProps

Props to be spread onto the previous scroll button

IconButtonOtherProps
-
nextScrollButtonProps

Props to be spread onto the next scroll button

IconButtonOtherProps
-
labelOverrides

Overrides for labels that have been defaulted in the component.

TabsLabelOverrides
-

Tab Props

NameDescriptionDefault
id*

The unique identifier for the tab, which should match the aria-labelledby of the corresponding TabPanel

string
-
onClick

A funtion that's called when the tab is clicked

MouseEventHandler<HTMLButtonElement>
-
onKeyDown

A function that's called to handle keydown events on the tab

KeyboardEventHandler<HTMLButtonElement>
-
icon

Icon to display next to the tab label

ReactNode
-

TabPanel Props

NameDescriptionDefault
title

Element with text to display as the title of the tab panel

ReactElement<any, string | JSXElementConstructor<any>>
-
subtitle

Element with text to display as the subtitle of the tab panel

ReactElement<any, string | JSXElementConstructor<any>>
-
aria-labelledby*

The id of the tab that controls and is associated with the tab panel

string
-

Questions?

Connect with the DLS Team on Slack or by email.

Resources

Check out additional resources.