Skip to content
Hazine

Underline Tabs with Sliding Indicator

A tab row on a hairline where one 2px indicator measures the active tab and slides to it. Use it to switch the top-level sections of a page, such as Overview, Deployments and Settings.

How it differs. One indicator element is measured against the active tab and moved, so no tab draws its own border. A row wider than its container scrolls, with paging buttons that stop at each end.

Install

pnpm dlx shadcn@latest add @hazine/tabs-underline-sliding-indicator

Adds 1 file, 1 shadcn primitive (tabs), and 2 packages (lucide-react, class-variance-authority).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": "https://api.hazine.dev/r/{name}.json"
  }
}

Needed once per project. Items resolve each other through the @hazine namespace.

Props5

tabs
TabItem[] = DEFAULT_TABS
density
"compact" | "default" | "comfortable" = "default"
locale
string = "en-US"
Formats the counts.
scrollBackLabel
string = "Scroll tabs back"
Names the button that scrolls an overflowing tab row toward its start.
scrollForwardLabel
string = "Scroll tabs forward"
Names the button that scrolls an overflowing tab row toward its end.

Also accepts every prop of Omit<React.ComponentProps<typeof Tabs>, "orientation">.

Accessibility

Keyboard
Keyboard support for Underline Tabs with Sliding Indicator
KeyEffect
TabMoves focus to the active tab, then into its panel
Arrow Right, Arrow LeftMoves to the next or previous tab, wrapping at the ends and skipping disabled tabs, and selects it. Mirrored in right-to-left layouts
Home, EndMoves to the first or last enabled tab and selects it
Screen reader

A tablist with automatic activation and a roving tab stop from the shadcn tabs primitive. Each panel is labelled by its tab. Counts are read in full, the indicator is decorative and the paging buttons are named but out of the tab order.

Reduced motion
The indicator jumps to the active tab without sliding, the row scrolls without easing and the count placeholders do not pulse.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies3

  • tabs
  • lucide-react
  • class-variance-authority

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.

More in Navigation