StealThis .dev

Tabs Vertical

Vertical and horizontal tab panels with animated sliding indicator, keyboard navigation, and lazy panel rendering. No dependencies.

Open in Lab
css vanilla-js
Targets: JS HTML

Code

Tabs Vertical

A flexible tab component supporting both vertical (sidebar) and horizontal (top bar) orientations, with a smooth animated active indicator, full keyboard navigation, and lazy panel activation.

Features

  • Vertical sidebar layout and horizontal top-bar layout in one component
  • Animated pill/indicator that slides between tabs
  • Full keyboard navigation: Arrow keys, Home, End
  • role="tablist", role="tab", role="tabpanel" ARIA structure
  • Badge count support on tab labels
  • Orientation toggle button to switch layouts dynamically

How it works

  1. Active indicator is an absolutely-positioned element; JS measures the active tab and moves it via style.top / style.left
  2. aria-selected, tabindex, and aria-controls are set on activation
  3. Arrow key listeners cycle through [role="tab"] elements respecting orientation