UnderlinePanels

The UnderlinePanels are used to break related content into tabbed panels.

Page navigation navigation

React
experimental
Rails
ready

Underlined panels let users switch between 2 or more related panels of content without changing the URL or leaving their current context.

If you want to use this pattern for tabs that change the URL when activated, use the UnderlineNav component instead.

React examples

Default

Panel 1
Panel 2
Panel 3

With counter badges

Panel 1
Panel 2
Panel 3

With leading icons

Panel 1
Panel 2
Panel 3

More code examples

The previous examples are a curated subset of the full capabilities (such as reponsive behavior) of the UnderlinePanels component. For more examples, see the UnderlinePanels Storybook stories.

Props

UnderlinePanels

NameDefaultDescription
aria-label
string

Accessible name for the tab list

aria-labelledby
string

ID of the element containing the name for the tab list

children Required
Array<UnderlinePanels.Tab | UnderlinePanels.Panel>

Tabs (UnderlinePanels.Tab) and panels (UnderlinePanels.Panel) to render

id
string

Custom string to use when generating the IDs of tabs and aria-labelledby for the panels

loadingCounters
false
boolean

Loading state for all counters. It displays loading animation for individual counters until all are resolved. It is needed to prevent multiple layout shift.

as
'div'
React.ElementType

The HTML element or React component used to render the outermost element.

UnderlinePanels.Tab

NameDefaultDescription
aria-selected
false
| boolean | 'true' | 'false'

Whether this is the selected tab. For more information about aria-selected, see MDN.

onSelect
(event) => void

The handler that gets called when the tab is selected

counter
number | string

Content of CounterLabel rendered after tab text label

icon
Component

Icon rendered before the tab text label

UnderlinePanels.Panel

See div for more prop options