Modus UI

Liquid Tabs

Web (React)

A tab switcher with a physics-driven, stretching selection pill.

A beautiful navigation primitive. The tab indicator mathematically squishes and stretches based on the physical velocity of the spring transition, rather than relying on standard hard-coded scales. If you jump multiple tabs, it stretches more!

Current Tab

overview

Installation

CLI

npx @modus-ui/cli add liquid-tabs

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/liquid-tabs.tsx.
  3. Paste the code.

Usage

tsx
import { LiquidTabs } from "@/components/ui/liquid-tabs";

export default function Example() {
  const tabs = [
    { label: "Home", value: "home" },
    { label: "Profile", value: "profile" },
    { label: "Settings", value: "settings" },
  ];

  return <LiquidTabs items={tabs} defaultValue="home" />;
}

Props

PropTypeDefaultDescription
itemsLiquidTabItem[]-The tabs to render.
defaultValuestring-The initially active tab when uncontrolled.
valuestring-The active tab when controlled.
onValueChange(value: string) => void-Called with the new value when a tab is selected.
squishnumber0.22How much the indicator stretches while it moves (0 disables the effect).

Comments

  • No comments yet.