Basic Usage
Tabs Props
Unique identifier for the tabs group. When set, the active tab is synced with the URL query parameter, allowing users to share links to specific tabs.
Color for the active tab indicator. Can be:
- A color token (e.g.,
"accent","blue") - A CSS color value (e.g.,
"#ff0000") - A tuple of two colors for gradient effects
When printing, determines whether to show all tabs or just the active tab. Set to
false to only print the currently visible tab.Makes each tab expand to fill available width equally. Useful for creating a more prominent tab bar.
Adds a background color to inactive tabs, creating more visual distinction between active and inactive states.
Tab Props
The text displayed on the tab button.
Unique identifier for the tab. Defaults to the label if not provided. Used in URL when parent Tabs has an id.
Whether this tab should be selected by default. If multiple tabs have
selected=true, the last one wins.Optional description text shown alongside the tab label.
Examples
Basic Tabs
Tabs with URL Sync
?report-view=summary or ?report-view=detailed, making it shareable.
Full Width Tabs with Background
Custom Color
Gradient Color
Default Selected Tab
Dynamic Tabs from Query
Print Behavior
By default, when printing a page with tabs, all tab content is shown sequentially. This ensures nothing is hidden in the printed output. To change this behavior:Use Cases
- Multi-period comparisons: Switch between different time periods
- Data views: Toggle between chart and table views of the same data
- Report sections: Organize long reports into digestible sections
- Product categories: Display different product lines or segments
- Geographic regions: Show data for different regions or markets
- Scenario analysis: Compare different scenarios or forecasts
Notes
- The first tab is automatically selected if no tab has
selected=true - Tab state is maintained when switching between tabs
- URL synchronization (when using
idprop) works without page reloads - Tabs are fully keyboard accessible
- The active tab is persisted in the URL query string when the Tabs component has an
id