Squiggle Tabs

A direction-aware, horizontal tabs component built on top of shadcn's Tabs. A hand-drawn squiggle underline wipes out of the old tab and into the new one, and panels fade in from the side you navigated towards.

Preview

Models

Pick from frontier and open-source models behind one API.

Installation

This component builds on the shadcn tabs component (the version with the line list variant), which is installed automatically if you don't have it yet. If you already have an older tabs, update it first.

npx shadcn@latest add "https://flow-kit-beta.vercel.app/r/squiggle-tabs.json"

API Reference

SquiggleTabs

Owns the active tab and the animation direction, and provides them through context. Accepts every prop of the shadcn Tabs root except orientation: the component is horizontal only.

PropTypeDefaultDescription
valuestringundefinedActive tab when controlled
defaultValuestring""Initially active tab when uncontrolled. No tab is active if omitted
onValueChange(value: string) => voidundefinedCalled when the active tab changes
squiggleColorstring"#ef4444"Default squiggle color for all triggers. Any CSS color
classNamestringundefinedAdditional CSS classes

SquiggleTabsList

A thin wrapper around the shadcn TabsList that defaults to the line variant.

PropTypeDefaultDescription
variant"default" | "line""line"Visual style of the list
classNamestringundefinedAdditional CSS classes

SquiggleTabsTrigger

A tab trigger that renders the animated squiggle while active. Accepts every prop of the shadcn TabsTrigger.

PropTypeDefaultDescription
valuestring—Unique value that links the trigger to its content
squiggleColorstringInherited from SquiggleTabsSquiggle color for this trigger
classNamestringundefinedAdditional CSS classes

SquiggleTabsContent

A wrapper around the shadcn TabsContent that fades its children in from the left or right depending on the direction of navigation. The first panel doesn't animate on page load, and the slide is skipped when the user prefers reduced motion. Horizontal overflow is clipped on the panel, so the slide never causes a scrollbar.

PropTypeDefaultDescription
valuestring—Value of the trigger this panel belongs to
classNamestringundefinedAdditional CSS classes, applied to the animated element that directly wraps your children (use it for flex, grid, spacing, ...)

useSquiggleTabs

FieldTypeDescription
activeTabstringValue of the currently active tab
direction"left" | "right"Direction of the last change. "right" means a later tab was selected
squiggleColorstringDefault squiggle color set on the root

Direction is worked out from the order of the triggers in the DOM, so you can render them from data, reorder them or add new ones without registering anything. Nested SquiggleTabs don't affect each other.