Tabs

Tabs allow the user to interact across the sections to switch from one set of content to another, making the transition easily from one peer to the other.

Props

NameTypeDescriptionDefault
Legacy
defaultActiveTabIndex
numberInitially active tab, only when it is uncontrolled.-
Legacy
activeTabIndex
numberThe index of the active tab. If undefined, the component will be uncontrolled and the active tab will be managed internally by the component.-
Legacy
tabs
{ label: string, icon: string | (React.ReactNode & React.SVGProps <SVGSVGElement>), isDisabled: boolean, notificationNumber: boolean | number }[]An array of objects representing the tabs. Each of them has the following properties:
  • label: Tab label.
  • icon: Material Symbol name or SVG element used as the icon that will be displayed in the tab. When using Material Symbols, replace spaces with underscores. By default they are outlined, if you want it to be filled prefix the symbol name with "filled_".
  • isDisabled: Whether the tab is disabled or not. If the component is uncontrolled and the selected tab is disabled, the first non-disabled tab from the array will be selected.
  • notificationNumber: It can have boolean type or number type. If true, an empty badge will appear. If false or if the tab is disabled, no badge will appear. If a number is specified, the component will display a badge with the value as its label. Take into account that if that number is greater than 99, it will appear as +99 in the badge.
-
Experimental
children
React.ReactNodeContains one or more DxcTabs.Tab.-
iconPosition'top' | 'left'Whether the icon should appear above or to the left of the label.'top'
Legacy
onTabClick
(index: number) => voidThis function will be called when the user clicks on a tab. The index of the clicked tab will be passed as a parameter.-
Legacy
onTabHover
(index: number) => voidThis function will be called when the user hovers a tab. The index of the hovered tab will be passed as a parameter.-
margin'xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge' | MarginSize of the margin to be applied to the component. You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.-
tabIndexnumberValue of the tabindex attribute applied to each tab.0

DxcTabs.Tab

Single tab, part of the set of Tabs.

Props

NameTypeDescriptionDefault
activebooleanWhether the tab is active or not.false
defaultActivebooleanWhether the tab is active or not by default, but mantaining the uncontrolled behaviour.false
disabledbooleanWhether the tab is disabled or not.false
Required
label
stringTab label text.-
title
stringTooltip text for the tab.-
iconstring | (React.ReactNode & React.SVGProps <SVGSVGElement>)Material Symbol name or SVG element as the icon that will be displayed in the tab. When using Material Symbols, replace spaces with underscores. By default they are outlined if you want it to be filled prefix the symbol name with "filled_".-
onClick() => voidThis function will be called when the user clicks on this tab. -
onHover() => voidThis function will be called when the user hovers this tab.-
notificationNumberboolean | numberIf true, an empty badge will appear. If false or if the tab is disabled, no badge will appear. If a number is specified, the component will display a badge with the value as its label. Take into account that if that number is greater than 99, it will appear as +99 in the badge.false
Required
children
React.ReactNodeContains the component to be rendered when this tab is active.-

Examples

Controlled

Uncontrolled

Icons and notifications

Examples (Legacy)

Controlled

Uncontrolled

Icons and notifications