ExpandableTabs
Animated icon tabs that expand to show labels on selection.
ExpandableTabs
Domain: navigation
Package path: packages/ui/src/navigation/expandable-tabs.tsx
Import: @ziteox/ui or @ziteox/ui/navigation
Horizontal tab strip. Icons only by default; the selected tab expands with a spring animation to reveal its label. Click outside to deselect.
Preview
Usage
Pass icons from your app (e.g. lucide-react). @ziteox/ui does not bundle icon libraries.
import { ExpandableTabs } from "@ziteox/ui";
import { Bell, Home, Settings } from "lucide-react";
const tabs = [
{ title: "Dashboard", icon: Home },
{ title: "Notifications", icon: Bell },
{ type: "separator" },
{ title: "Settings", icon: Settings },
];
export function NavTabs() {
return (
<ExpandableTabs
tabs={tabs}
onChange={(index) => console.log("selected", index)}
/>
);
}Install the motion peer in your app. Icons come from your app (for example lucide-react); they are not a package peer.
pnpm add motionProps
| Prop | Type | Required | Description |
|---|---|---|---|
tabs | ExpandableTabItem[] | Yes | Tab definitions or { type: "separator" } |
className | string | No | Appended to root container |
activeClassName | string | No | Extra class on the selected tab button |
onChange | (index: number | null) => void | No | Selection changes; null when cleared |
Tab items
{ title: "Dashboard", icon: Home }
{ type: "separator" }icon must be a React component accepting optional size?: number.
Animation
motion/reactfor button gap/padding and label width- Spring transition (
bounce: 0,duration: 0.6) - Click outside clears selection (
useOnClickOutsidein package)
Styling
Scoped CSS with ziteox-expandable-tabs-* classes. Theme-aware via .dark / [data-theme="dark"].
No Tailwind inside the package. Use className and activeClassName only if your app needs extra layout or overrides on top of the built-in styles.