Tabs
Sliding Tabs
Tabs with an active pill that springs from tab to tab and panels that slide in the direction of travel.
npx motionsnack add sliding-tabsCustomize
<SlidingTabs />Props
11 properties
| Property | Type | Default | Description |
|---|---|---|---|
| items | { value?: string; label: string; content?: string; count?: number; disabled?: boolean }[] | 4 demo tabs | Tabs with their panel text. `value` falls back to the position. |
| children | ReactNode | - | Panel content of the selected tab. Replaces the items' content; switch it on value. |
| orientation | 'horizontal' | 'vertical' | 'horizontal' | Tabs in a row, or a column with the indicator on the start side. |
| activation | 'automatic' | 'manual' | 'automatic' | Automatic: focus selects. Manual: arrows move focus, Enter / Space selects. |
| label | string | 'Sections' | Name of the tab list for screen readers. |
| value | string | - | Controlled selected tab (its value). |
| defaultValue | string | first tab | Tab that is active on first render when uncontrolled. |
| onChange | (value: string) => void | - | Called with the value of the tab the user picked. |
| className | string | '' | Extra classes on the wrapper. |
| variant | 'pill' | 'line' | 'pill' | A raised pill behind the tabs or a 2px line under them. |
| fullWidth | boolean | false | Tabs share the full width instead of hugging their labels. |
About Sliding Tabs
Sliding Tabs renders a tab list from an array of labels and texts. The active indicator is one shared element, so it slides between tabs with a spring bounce instead of jumping. The panels cross-fade and shift a few pixels in the direction you moved, which makes the order of the tabs easy to feel. Two variants are included: a filled pill inside a glass track and a gradient underline. Arrow keys, Home and End move between tabs with a roving tabindex, and the component works controlled or uncontrolled.
What's included
- Shared-layout indicator with adjustable spring bounce
- Panels cross-fade and slide in the direction of travel
- Pill and underline variants
- Arrow keys, Home and End with roving tabindex
- Controlled or uncontrolled: value, defaultValue, onChange
- Correct tablist, tab and tabpanel roles
- Reduced-motion fallback to plain fades
- Type
- Animated React tabs component
- Library
- Components · Tabs
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-09-20
- Install
npx motionsnack add sliding-tabs