HuxTabs
The HuxTabs component provides a clean and modern way to organize content into multiple panels with tab navigation. It supports multiple variants, sizes, and includes built-in theme awareness.Basic Usage
Variants
Default
The default variant displays tabs with an underline indicator.Pill
The pill variant displays tabs with a background indicator that highlights the active tab.Minimal
The minimal variant displays tabs without any indicator, relying on text color changes.Sizes
Small
Medium (Default)
Large
With Icons
Add icons to your tabs for better visual hierarchy.With Badges
Add badges to indicate notifications or counts.Scrollable Tabs
Enable horizontal scrolling for tabs that don’t fit in the available space.Tab Alignment
Control how tabs are aligned within the available space.Disabled Tabs
Mark individual tabs as disabled to prevent interaction.Expanding Content
By default, tab content takes only the space it needs. UseexpandContent to fill available vertical space.
Set
expandContent: true when tabs are in a bounded container (like an Expanded widget) and you want the content to fill available space. Leave it false (default) for better compatibility with unbounded layouts.Controlled Tabs
Control the active tab programmatically.API Reference
HuxTabs
| Property | Type | Default | Description |
|---|---|---|---|
tabs | List<HuxTabItem> | required | List of tab items to display |
initialIndex | int | 0 | Initial active tab index |
variant | HuxTabVariant | HuxTabVariant.default_ | Visual variant of the tabs |
size | HuxTabSize | HuxTabSize.medium | Size variant of the tabs |
onTabChanged | ValueChanged<int>? | null | Callback when the active tab changes |
isScrollable | bool | false | Whether tabs should be scrollable horizontally |
alignment | TabAlignment | TabAlignment.start | Alignment of tabs within the available space |
expandContent | bool | false | Whether content should expand to fill available vertical space |
HuxTabItem
| Property | Type | Default | Description |
|---|---|---|---|
label | String | required | The text label displayed on the tab |
content | Widget | required | The content widget displayed when this tab is active |
icon | IconData? | null | Optional icon displayed before the label |
badge | Widget? | null | Optional badge widget displayed after the label |
isDisabled | bool | false | Whether this tab is disabled |
HuxTabVariant
HuxTabVariant.default_- Default tabs with underline indicatorHuxTabVariant.pill- Pill-style tabs with background indicatorHuxTabVariant.minimal- Minimal tabs with no indicator
HuxTabSize
HuxTabSize.small- Small tabs for compact layoutsHuxTabSize.medium- Medium tabs for standard layouts (default)HuxTabSize.large- Large tabs for prominent navigation
Theming
HuxTabs automatically adapts to light and dark themes using HuxTokens. The component uses the following design tokens:HuxTokens.tabActiveBackground- Background color for active tabHuxTokens.tabActiveText- Text color for active tabHuxTokens.tabInactiveBackground- Background color for inactive tabHuxTokens.tabInactiveText- Text color for inactive tabHuxTokens.tabHoverBackground- Hover background color for tabsHuxTokens.tabBorder- Border color for tab containerHuxTokens.tabIndicator- Indicator color for active tab
The tabs component follows Hux UI design principles with consistent spacing, typography, and color usage. All variants automatically adapt to your theme configuration.