Import
Description
A tabs component for organizing content into multiple panels, where only one panel is visible at a time. Includes keyboard navigation and an animated indicator.Usage
API
tabs.root() / tabs()
Root container that groups tabs and panels. Renders a<div> element.
Initial selected tab value (uncontrolled). When null, no tab is selected
Currently selected tab value (controlled). When null, no tab is selected
Layout flow direction of the tabs
Custom root component
Event Handlers
Called when a new tab is selected. Receives the tab value
tabs.list()
Container for the tab buttons. Renders a<div> element.
Whether to automatically activate tabs when focused with arrow keys. When false, tabs require Enter or Space to activate
Whether to loop keyboard focus back to first item when reaching the end with arrow keys
tabs.tab()
Individual tab button. Renders a<button> element.
The value of the tab. When not specified, uses the child position index
Whether to render a native button element when using render prop
Whether the tab is disabled
Custom tab component
tabs.indicator()
Visual indicator showing the active tab position. Renders a<span> element.
Whether to render before React hydrates. Minimizes time the indicator is invisible after SSR
Custom indicator component
tabs.panel()
Panel displayed when corresponding tab is active. Renders a<div> element.
The value of the panel. Shown when tab with same value is selected. Required for server-side rendering
Whether to keep the panel HTML element in DOM while hidden
Custom panel component
Class Names
Access default class names viatabs.class_names:
ROOT: Root container styling with flex layoutLIST: Tab list container with background and paddingTAB: Individual tab button styling with statesINDICATOR: Animated indicator showing active tabPANEL: Panel container styling
Keyboard Navigation
- Arrow Keys: Navigate between tabs
- Enter/Space: Activate focused tab (when
activate_on_focus=False) - Home: Focus first tab
- End: Focus last tab