Sliding Tabs
Free, copy-pasteable Tailwind CSS & Framer Motion Sliding Tabs component. Accessible, fully responsive, dark-mode ready, and customizable.
On this page
Create fluid and premium transitions between views with Sliding Tabs. Using Framer Motion's shared layout animations (layoutId), the active background capsule or underline morphs and slides smoothly from tab to tab. It also includes subtle hover highlight backdrops to elevate visual interactive feedback.
Perfect for toggle selectors, settings navigation, user profile dashboard sub-views, and top bar layouts.
Implementation
Usage
Stateful Demo
Toggle between these tabs to view the layout shifts and slide transitions in action on both variants.
Dashboard Hub
Welcome back! Here is a summary of your workspace activities and deployments.
System Overview
API Server is active. Latency: 14ms. Zero package failures detected over the last 24h.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tabs | Tab[] | — | Array of tab items, containing id, label, and optional icon |
activeTab | string | — | The active tab item id |
onChange | (id: string) => void | — | Triggered callback when clicking a tab |
className | string | "" | CSS classes for the outer container |
tabClassName | string | "" | CSS classes for the individual buttons |
highlightClassName | string | "" | CSS classes for the sliding active indicator |
variant | "pill" | "underline" | "pill" | Visual variant style to display |