Tabs
Reduce visual complexity of long forms using tabs.
Use TabNav for navigation links styled as tabs.
#
#
#
Add the following props to a Tab to add decorations to the tab:
- Add the
countprop to display a gray badge with the count within the Tab. - Add the
countFormatterprop to change the way the count is rendered. - Add the
badgeVariantprop to change the variant of the badge within the Tab. - Add the
tooltipprop to add a tooltip to the text. - Add the
statusIndicatorprop to add an extra indicator to the right of the Tab text.
Use these instead of directly rendering additional components within the Tab itself.
#
There are cases when state of tabs is managed elsewhere. For example, when tabs are switched based on the current URL.
#
Tabs have their own loading state when used with the Skeleton component.
#
#
- When there are many related sections and one section needs to be shown at a time.
#
- When content from multiple tabs needs to be shown at the same time.
- As a way to indicate progress of filling out a form or a similar component.
- As a way to filter content.
#
- Use sentence case for tab titles.
- Keep tab titles to 3 words max.
#
It is important to directly nest Tab within the parent TabList. Any intermediate elements will break a11y compliance.
#
#
Inherits margin props.
| Name | Default | Description |
|---|
#
| Name | Default | Description |
|---|---|---|
children | — | ReactNodeTabs. |
#
| Name | Default | Description |
|---|---|---|
badgeVariant | — | BadgeProps["variant"]The variant of the badge if a count is provided. |
children | — | stringTab title. |
count | — | numberOptional count to display near the title. |
countFormatter | — | (count: number) => string | numberOptional function to format the count. |
tooltip | — | Omit<TooltipProps, "children">Optional tooltip to add to the text. |
statusIndicator | — | ReactNodeOptional status indicator to place to the right of the text. |
isDisabled | false | booleanIf tab is disabled. |
#
| Name | Default | Description |
|---|---|---|
children | — | ReactNodeTab panels. |
#
| Name | Default | Description |
|---|---|---|
children | — | ReactNodeTab content. |