UnderlinePanels
The UnderlinePanels are used to break related content into tabbed panels.
Page navigation navigation
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
With counter badges
With leading icons
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
| Name | Default | Description |
|---|---|---|
aria-label | stringAccessible name for the tab list | |
aria-labelledby | stringID of the element containing the name for the tab list | |
value | stringThe value of the selected tab, keyed to each | |
defaultValue | stringThe value of the tab selected by default, for an uncontrolled component. Cannot be combined with | |
onChange | ({value}: {value: string}) => voidCallback fired whenever the selected tab changes, for every selection method — pointer, Enter/Space, and Arrow/Home/End keys. Unlike | |
activationMode | 'automatic' | 'automatic' | 'manual'Controls how tabs are activated with the keyboard. |
children Required | Array<UnderlinePanels.Tab | UnderlinePanels.Panel>Tabs (UnderlinePanels.Tab) and panels (UnderlinePanels.Panel) to render | |
id | stringCustom string to use when generating the IDs of tabs and | |
loadingCounters | false | booleanLoading 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.ElementTypeThe HTML element or React component used to render the outermost element. |
UnderlinePanels.Tab
| Name | Default | Description |
|---|---|---|
value | stringA value that uniquely identifies this tab, paired with the | |
aria-selected | false | | boolean | 'true' | 'false'Whether this is the selected tab. For more information about |
onSelect | (event) => voidThe handler that gets called when the tab is selected. Note: this fires only on click and Enter/Space — not on arrow-key navigation. For a callback that fires for every selection method, use the container's | |
counter | number | stringContent of CounterLabel rendered after tab text label | |
icon | ComponentIcon rendered before the tab text label |
UnderlinePanels.Panel
| Name | Default | Description |
|---|---|---|
value | stringA value that uniquely identifies this panel, paired with the |