Tabs

Tabs are used to organize content by grouping similar information on the same page.

Neutral selected states

When the platform-dst-tokens-finesse feature flag is enabled, this component uses the new neutral treatment for selected states.

Installation

Package installation information
Installyarn add @atlaskit/tabs
SourceBitbucket.org, (opens new window)
npm@atlaskit/tabs, (opens new window)
Bundleunpkg.com, (opens new window)

Props

Tabs props

analyticsContext

Description

Additional information to be included in the context of analytics events that come from Tabs.

Type{ [x: string]: any; }

children

Required
Description

The children of Tabs. The first child should be a TabList filled with Tab's. Subsequent children should be TabPanel's. There should be a Tab for each TabPanel. If you want to customize Tab or TabPanel, refer to the examples in the documentation.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

createAnalyticsEvent

Description

You should not be accessing this prop under any circumstances. It is provided by @atlaskit/analytics-next and integrated in the component

Type(payload: AnalyticsEventPayload) => UIAnalyticsEvent

defaultSelected

Description

The index of the tab that will be selected by default when the component mounts. If not set the first tab will be displayed by default.

Typenumber

id

Required
Description

A unique ID that will be used to generate IDs for tabs and tab panels. This is required for accessibility purposes.

Typestring

onChange

Description

A callback function which will be fired when a changed. It will be passed the index of the selected tab and a UIAnalyticsEvent.

Type(index: number, analyticsEvent: UIAnalyticsEvent) => void

ref

Description
No description.
Type((instance: any) => void) | RefObject<any>

selected

Description

The selected tab's index. If this prop is set the component behaves as a controlled component. It will be up to you to listen to onChange.

Typenumber

shouldUnmountTabPanelOnChange

Description

Tabs by default leaves TabPanel's mounted on the page after they have been selected. If you would like to unmount a TabPanel when it is not selected, set this prop to be true.

Typeboolean

testId

Description

A testId prop is a unique string that appears as a data attribute data-testid on the Tabs element, serving as a hook for automated tests.

Typestring

Tab props

children

Required
Description

The children to be rendered within a Tab.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

testId

Description

A testId prop is is a unique string that appears as a data attribute data-testid on the Tab element, serving as a hook for automated tests.

Typestring

Tab panel props

children

Required
Description

The children to be rendered within a TabPanel.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

testId

Description

A testId prop is is a unique string that appears as a data attribute data-testid on the TabPanel element, serving as a hook for automated tests.

Typestring

Hooks

useTab

useTab will return an object of type TabAttributesType.

aria-controls

Required
Description

The ID of the tab panel that this tab links.

Typestring

aria-posinset

Required
Description

The position of this tab within the tab list.

Typenumber

aria-selected

Required
Description

Whether this tab is selected.

Typeboolean

aria-setsize

Required
Description

The number of tabs in this tab list.

Typenumber

id

Required
Description

ID of the tab.

Typestring

onClick

Required
Description

Changes the selected tab.

Type() => void

onKeyDown

Required
Description

Allows navigation of tabs with automatic activation. Read here for more details: https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html

Type(e: KeyboardEvent<HTMLElement>) => void

role

Required
Description

Role is "tab".

Type"tab"

tabIndex

Required
Description

If the tab is selected the tab index is 0 and is focusable. Otherwise it is -1 and is not focusable.

Typenumber

useTabPanel

useTabPanel will return an object of type TabPanelAttributesType.

aria-labelledby

Required
Description

The id of the tab that links to this tab panel.

Typestring

hidden

Description

Hidden is true if it is not the selected tab.

Typeboolean

id

Required
Description

ID of the the tab panel.

Typestring

role

Required
Description

Role is "tabpanel".

Type"tabpanel"

tabIndex

Required
Description

If the tab panel is selected the tab index is 0 and is focusable. Otherwise it is -1 and is not focusable.

Typenumber
Was this page helpful?
We use this feedback to improve our documentation.
© 2026 AtlassianTrademark, (opens new window)Privacy, (opens new window)License