Skip to content

Tabs

Peer views of one thing: a pill or underline that glides between tabs, panels that slide the way you moved, overflow edge buttons, counts that roll, and closable terminal tabs.

oxyn add tabs
MCP

Atlas is healthy. 12 runs today, 2 waiting on review, $18.40 spent.

Dioxus
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        on_change: move |v: String| route.set(v),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • Peer views of one object (Overview · Runs · Approvals · Settings), and the terminal strip of a coding agent where each tab is a shell that can be closed, added and keeps a busy dot while a command runs.

When not to use

  • Switch between two to six options: use Segmented Control instead.
  • Terminal tabs: use Terminal tabs instead.
  • A project header that folds into a compact bar as the page scrolls, with breadcrumb, actions and tabs whose counts roll: use Page header instead.

Installation

Tabs is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add tabs
Rust
use crate::oxyn::{Tabs, PRIMITIVES_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{Tabs, PRIMITIVES_CSS};

Usage

Dioxus · rust
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        on_change: move |v: String| route.set(v),
    }
}

Examples

Pill

A gliding pill over a sunken strip.

Atlas is healthy. 12 runs today, 2 waiting on review, $18.40 spent.

Code
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        on_change: move |v: String| route.set(v),
    }
}

Underline

An underline that slides.

Atlas is healthy. 12 runs today, 2 waiting on review, $18.40 spent.

Code
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        variant: "underline",
        on_change: move |v: String| route.set(v),
    }
}

Enclosed

Folder tabs over a rule (Oxyn plus).

Atlas is healthy. 12 runs today, 2 waiting on review, $18.40 spent.

Code
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        variant: "enclosed",
        on_change: move |v: String| route.set(v),
    }
}

Overflow

Too many tabs: the strip scrolls with edge buttons.

Atlas is healthy. 12 runs today, 2 waiting on review, $18.40 spent.

Code
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        on_change: move |v: String| route.set(v),
    }
}

Terminal

Closable terminal tabs with busy dots and a + (Oxyn plus).

$ cargo test -p oxyn-core
   Compiling oxyn-core v0.3.0
    Running unittests src/lib.rs
test primitives::layout::tabs ... ok
test primitives::layout::tree ... ok
▌
Code
let tabs = vec![Tab::new("overview", "Overview"), Tab::new("runs", "Runs").count(24)];

rsx! {
    Tabs {
        tabs: tabs,
        panels: vec!["Summary".into(), "Recent runs".into()],
        variant: "terminal",
        on_change: move |v: String| route.set(v),
    }
}

API reference

Tabs

PropTypeDefaultDescription
tabsrequiredVec<Tab>—Tabs.
valueOption<String>Default::default()Selected value (initial).
panelsVec<String>Default::default()Panel text per tab (same order).
variantString"pill"`pill` · `underline` · `enclosed` · `terminal`.
sizeString"md"`sm` · `md`.
manualboolDefault::default()Manual activation (arrows only move focus).
labelString"Tabs"Tab list label.
fullboolDefault::default()Fill the width (equal tabs).
addableboolDefault::default()Terminal variant: show the "+" button.
on_changeEventHandler<String>—Selection changed.
on_closeEventHandler<String>—A tab closed (value).
childrenElementDefault::default()Extra content under the strip.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
← →Move between tabs (and select, unless manual)
HomeorEndFirst / last tab
EnterorSpaceSelect the focused tab (manual)
DeleteClose the focused terminal tab
TabInto the panel

Accessibility

  • tablist / tab / tabpanel with aria-selected and aria-controls; one tab stop.
  • Overflow buttons are labelled “Scroll tabs left / right”.
  • The pill is aria-hidden; panels re-key so the old one never takes focus.
From the spec

tablist / tab / tabpanel with aria-controls and aria-labelledby; one tab stop. The outgoing panel is gone (re-keyed), so it can never take focus. Overflow buttons are tabindex=-1 because the arrows already reach every tab.

Motion & interaction

One pill per instance glides between triggers (transform + width, measured with onmounted); keyboard moves jump. Panels re-key on every change and slide 8 px from the side the selection came from. Counts roll up when they change; the close button fades in on hover or selection.

Timing
TransitionDurationEasingReduced motion
Pill glide240 msease.outjump
Panel slide240 msease.outfade
Count roll220 msease.outswap
Close fade120 mslinearinstant

Responsive behaviour

  • The strip scrolls horizontally; edge buttons appear only when it overflows.
  • Tabs keep a 5.5rem minimum width (sm drops it).
Edge cases (spec)

Many tabs scroll; focusing a tab keeps it in view. Closing the last terminal leaves an empty strip with only “+”. Disabled first tab: the tab stop moves to the first enabled tab. Labels never wrap; terminal labels ellipsize at 16ch.

Notes for AI

  • Import Tabs from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: TabsEl in oxyn_gpui.
  • Props to set first: tabs.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI