Tabs

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Installation

Command to install the Tabs component.

Component Guide

Use the following to build the Tabs component.

from components.ui.tabs import tabs

Source Code & Dependencies

For manual installation, copy each of the source codes below in their respective locations.

components/core/core.py

components/ui/tabs.py

Examples

Basic

Line

Use the variant="line" prop on tabs.list for a line style.

Vertical

Use orientation="vertical" for vertical tabs.

Disabled

Use disabled=True to disable a tab.

Icons

API Reference

tabs.root

The main container component that initializes your tab instance, holds the active state configuration on the client, and dictates the layout orientation.

tabs.root(
    tabs.list(
        tabs.trigger("Overview", value="overview"),
        tabs.trigger("Analytics", value="analytics"),
    ),
    tabs.content(
        "Overview panel data",
        value="overview"
    ),
    default_value="overview",
)
Prop Type Default
default_value str ""
orientation Literal["horizontal", "vertical"] "horizontal"
class_name str ""

tabs.list

Groups the trigger navigation buttons together and controls the visual theme style.

tabs.list(
    tabs.trigger("Tab 1", value="tab1"),
    tabs.trigger("Tab 2", value="tab2"),
    variant="line",
)
Prop Type Default
variant Literal["default", "line"] "default"
class_name str ""

tabs.trigger

The clickable button elements used to switch active states. They safely merge internal client-side JS actions with optional user-supplied events.

tabs.trigger(
    "Analytics",
    value="analytics",
    on_click=rx.console_log("Switched tabs!")
)
Prop Type Default
value str Required
class_name str ""
id str Auto-generated UUID
disabled bool False
on_click Union[EventHandler, list[EventHandler]] None
on_mount Union[EventHandler, list[EventHandler]] None

tabs.content

The structural panel containing content mapped to a specific tab trigger value. Toggles layout visibility instantly purely using CSS attribute matching.

tabs.content(
    "Your dashboard analytics modules go here.",
    value="analytics",
)
Prop Type Default
value str Required
class_name str ""