
Navigation · €7
Elastic tabs
Tabs whose highlight stretches like elastic between options.
Pay once on Gumroad: the download, plus a licence key for the registry and the MCP server.
Details
- Category
- Navigation
- Plan
- Paid, €7 once
- Code
- React + Tailwind, TypeScript · 301 lines
- Files
- ElasticTabs.tsx
- Needs
- React and Tailwind only
- Agents
- MCP server and shadcn registry
About
Tabs with an indicator that moves like a drop. The front edge leaves first and the back edge catches up, so it stretches (and gets a little thinner) on the way, then lands with a small wobble. Grab it and drag: it follows your finger, stretches with your speed, gives like rubber past the ends and drops on the nearest tab. The labels under it change colour right at its edge. Mouse, touch and keyboard, and it works with screen readers. White and black versions, any colour. React + Tailwind, no other libraries. Respects reduced motion.
Install
Once: add the StackD registry to components.json, with the licence key from your receipt in STACKD_LICENSE_KEY (in .env.local):
"registries": {
"@stackd": {
"url": "https://www.stackd.codes/r/{name}.json",
"headers": { "X-License-Key": "${STACKD_LICENSE_KEY}" }
}
}With the shadcn CLI:
npx shadcn@latest add @stackd/elastic-tabsOr let your agent add it through the StackD MCP server:
claude mcp add --transport http stackd https://www.stackd.codes/mcpPrompt for your agent
Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.
Add the StackD Elastic tabs component to this project. Use the StackD MCP server: call get_component with { "name": "elastic-tabs" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles. It is a paid component: if the server says it needs a licence, tell me where to buy it.Use
- Copy
ElasticTabs.tsxinto your project (for examplecomponents/ElasticTabs.tsx). - Use it:
import { ElasticTabs } from './components/ElasticTabs'
const range = [
{ id: 'day', label: 'Day' },
{ id: 'week', label: 'Week' },
{ id: 'month', label: 'Month' },
{ id: 'year', label: 'Year' },
]
<ElasticTabs tabs={range} onChange={(id) => setRange(id)} />
With icons, on a black bar, in Lilac:
const nav = [
{ id: 'home', label: 'Home', icon: <HomeIcon /> },
{ id: 'search', label: 'Search', icon: <SearchIcon /> },
{ id: 'inbox', label: 'Inbox', icon: <InboxIcon /> },
]
<ElasticTabs tabs={nav} theme="dark" color="#C9B8FF" />
<ElasticTabs tabs={nav} iconOnly /> // icons only, labels kept for screen readers
Any SVG icon works; it is sized to 18 px and takes the text colour (currentColor).
To keep the selected tab in your own state:
const [tab, setTab] = useState('week')
<ElasticTabs tabs={range} value={tab} onChange={setTab} />
In Next.js the file already starts with 'use client'. In other React setups that line does nothing.
Options
| Prop | Default | What it does |
|---|---|---|
tabs | { id, label, icon? }[] | |
value | Controlled selected id. Leave it out and the tabs keep their own | |
defaultValue | first tab | Starting tab when not controlled |
onChange | Called with the id of the new tab | |
theme | 'light' | 'light' (white bar) or 'dark' (black bar) |
color | ink on light, white on dark | The indicator's colour. The text on it turns ink or white, whichever reads better |
fill | false | Stretch the bar to the width of its parent, tabs sharing the space |
iconOnly | false | Show only the icons |
aria-label | 'Tabs' | Name of the tab list for screen readers |
Tuning the stretch
At the top of the file: FRONT and BACK are the springs of the two edges. A bigger gap between their k values means a longer stretch; a lower z on FRONT means more wobble.
Keyboard
Left / Right: previous / next tab. Home / End: first / last.
Colours from StackD
White #FFFFFF · Ink #141310 · Wine #901919 · Olive #6C8544 · Ochre #BE9344 · Lilac #C9B8FF
Licence
You can use it in personal and commercial projects. Don't resell or share the component on its own.
Made by StackD · stackd.codes


