Container used to organize and group related content into smaller sections navigable within a single container
Tabs align left and bottom border expands to full width of container.
Reduced spacing around the tabs to create a denser visual design.
Tabs space evenly across the container.
Bottom border of tab header list is removed.
Centered tab header content.
Tabs using the active-tab
property to make the third element active on page load.
Tabs using height="auto"
to render with variable height based on content size.
Tabs component maintains these keyboard interactions:
This component has compliance with WCAG guidelines by:
Linking to a specific tab or accordion has SEO costs. If you still wish to implement these changes for your project, reach out to the SEO team at the #team-seo and #team-ia Slack channels.
Tabs are built from two components: CdrTabs and CdrTabPanel. These are meant to be used together.
height
name
string
type
240px
default
Sets height of the tabs container element. Passing a `px` value will render tabs with a static height, passing `auto` will render tabs with variable height based on content size.
activeTab
name
number
type
0
default
Sets the index of the tab that should be active on initial page load. Note that this property is zero-indexed.
modifier
name
string
type
N/A
default
Modifies the style variants for this component. Possible values: { 'centered' | 'compact' | 'full-width' | 'no-border' }
backgroundColor
name
string
type
$cdr-color-background-primary
default
For CdrTabs that are rendered on non-primary backgrounds. Pass the background-color into the component to ensure that the scrolling gradients render correctly.
name
name
string
type
N/A
default
Sets tab display name. Required and must be unique for each tab. If id prop not provided, this value will be used as the reference identifier.
id
name
string
type
N/A
default
Sets reference identifier for tab content. This property is required and is necessary for accessibility. Must be unique for each tabPanel, and cannot be the same as the `aria-labelledby` property.
aria-labelledby
name
string
type
N/A
default
Sets reference identifier for tab header. This property is required and is necessary for accessibility. Must be unique for each tabPanel, and cannot be the same as the `id` property.
tab-change
name
state, tabId
arguments
$emit event fired when the active tab has been changed.
The cdr-tab-panel name
property sets the tab display value and is used for reference.
<cdr-tabs>
<cdr-tab-panel name="tab1">Tab 1 Content</cdr-tab-panel>
</cdr-tabs>
Following variants are available to the cdr-tabs
modifier attribute:
Value | Description |
---|---|
'centered' | Centers the tab header content |
'compact' | Sets the tabs styling for smaller screen sizes |
'full-width' | Sets the tab header to display evenly across the entire width instead of left justified |
'no-border' | Removes the bottom border of the tabs header |