Overview
TheTabs component provides tab navigation with two distinct visual designs. The primary design uses an underline indicator for the selected tab, while the secondary design uses a rounded background. Both designs support customizable colors and styles.
Basic Usage
Examples
Primary Design (Underline)
Secondary Design (Rounded Background)
Custom Colors
With Custom Styling
Controlled Component
With Background Container
Props
Array of tab options. Each option must include an
id and title.Visual design variant:
primary: Underline indicator below selected tabsecondary: Rounded background behind selected tab
Currently selected tab (controlled component). If not provided, the first option is selected by default.
Callback fired when tab selection changes. Receives the newly selected option object.
Background color for the selected tab (secondary design) or underline color (primary design). Defaults to theme colors if not provided.
Text color for the selected tab. Defaults to
Color.text.primary if not provided.Background color for the entire tabs container.
Custom CSS styles to apply to the container element.
Custom CSS styles to apply to individual tab cells.
Custom CSS styles to apply to tab text labels.
OptionProps Interface
Styling
Primary Design
- Container height: 36px
- Gap between tabs: 16px
- Selected indicator: 2px solid border-bottom
- Default indicator color:
Color.line.primary - Selected text color:
Color.text.primary - Unselected text color:
Color.text.high
Secondary Design
- Gap between tabs: 4px
- Tab padding: 7px vertical, 16px horizontal
- Border radius: 32px (fully rounded)
- Selected background:
Color.background.primaryLow(or custom) - Hover background:
Color.status.neutral.hover - Transition: 0.15s ease-in
Accessibility
- Container has
role="container"attribute - Each tab cell has a
roleattribute set to itsid - Hover states provide visual feedback
- Click targets are adequately sized for touch and mouse interaction
TypeScript
Best Practices
- Use
primarydesign for main navigation,secondaryfor filters or views - Keep tab titles concise (1-2 words) for better readability
- Provide
selectedOptionif you need controlled component behavior - Use consistent tab counts across different screen sizes
- Consider responsive design: secondary tabs work better on mobile
- Use
onChangecallback to update your view or fetch data - Ensure tab IDs are unique within the component