Primitives
Segmented
Pill, solid, outline, glass; three sizes; the thumb slides. Two or three options — beyond three it becomes a Select.
"use client";
import { Segmented } from "@waveinno/ui";
import { Columns3, LayoutGrid, List } from "lucide-react";
import * as React from "react";
export default function SegmentedDemo() {
const [view, setView] = React.useState<"day" | "week" | "month">("week");
const [layout, setLayout] = React.useState<"grid" | "list" | "board">("grid");
const [plan, setPlan] = React.useState<"monthly" | "yearly">("yearly");
const periods = [
{ value: "day" as const, label: "Day" },
{ value: "week" as const, label: "Week" },
{ value: "month" as const, label: "Month" },
];
return (
<div className="space-y-4">
<div className="flex flex-wrap items-center gap-4">
<Segmented value={view} onChange={setView} options={periods} />
<Segmented value={view} onChange={setView} options={periods} size="md" />
<Segmented value={view} onChange={setView} options={periods} size="lg" variant="solid" />
</div>
<div className="flex flex-wrap items-center gap-4">
<Segmented
value={layout}
onChange={setLayout}
size="md"
variant="outline"
options={[
{ value: "grid", label: <><LayoutGrid /> Grid</> },
{ value: "list", label: <><List /> List</> },
{ value: "board", label: <><Columns3 /> Board</> },
]}
/>
<div className="rounded-[14px] bg-[linear-gradient(135deg,#1437d3,#7560fd)] p-3">
<Segmented value={plan} onChange={setPlan} size="md" variant="glass" options={[{ value: "monthly", label: "Monthly" }, { value: "yearly", label: "Yearly −20%" }]} />
</div>
</div>
<div className="max-w-md">
<Segmented value={view} onChange={setView} options={periods} size="md" variant="solid" fullWidth />
</div>
</div>
);
}Examples#
Each one on its own: copy its code into your app, or copy it to Figma and paste it on the canvas as layers.
Pill
The default: a quiet track for filters and view switches.
"use client";
import { Segmented } from "@waveinno/ui";
import * as React from "react";
function SegmentedLook({ variant, size = "sm" }: { variant: "pill" | "solid" | "outline"; size?: "sm" | "md" | "lg" }) {
const [view, setView] = React.useState<"day" | "week" | "month">("week");
return (
<Segmented
ariaLabel="Period"
value={view}
onChange={setView}
variant={variant}
size={size}
options={[
{ value: "day", label: "Day" },
{ value: "week", label: "Week" },
{ value: "month", label: "Month" },
]}
/>
);
}
export default function SegmentedPillExample() {
return (
<SegmentedLook variant="pill" />
);
}Solid
A raised thumb: for the main switch of a page.
"use client";
import { Segmented } from "@waveinno/ui";
import * as React from "react";
function SegmentedLook({ variant, size = "sm" }: { variant: "pill" | "solid" | "outline"; size?: "sm" | "md" | "lg" }) {
const [view, setView] = React.useState<"day" | "week" | "month">("week");
return (
<Segmented
ariaLabel="Period"
value={view}
onChange={setView}
variant={variant}
size={size}
options={[
{ value: "day", label: "Day" },
{ value: "week", label: "Week" },
{ value: "month", label: "Month" },
]}
/>
);
}
export default function SegmentedSolidExample() {
return (
<SegmentedLook variant="solid" size="md" />
);
}Outline with icons
Icons and words for layout switches.
"use client";
import { Segmented } from "@waveinno/ui";
import { Columns3, LayoutGrid, List } from "lucide-react";
import * as React from "react";
export default function SegmentedIconsExample() {
const [layout, setLayout] = React.useState<"grid" | "list" | "board">("grid");
return (
<Segmented
ariaLabel="Layout"
value={layout}
onChange={setLayout}
size="md"
variant="outline"
options={[
{ value: "grid", label: <><LayoutGrid /> Grid</> },
{ value: "list", label: <><List /> List</> },
{ value: "board", label: <><Columns3 /> Board</> },
]}
/>
);
}Sizes
sm in toolbars, md in forms, lg in heroes.
"use client";
import { Segmented } from "@waveinno/ui";
import * as React from "react";
function SegmentedLook({ variant, size = "sm" }: { variant: "pill" | "solid" | "outline"; size?: "sm" | "md" | "lg" }) {
const [view, setView] = React.useState<"day" | "week" | "month">("week");
return (
<Segmented
ariaLabel="Period"
value={view}
onChange={setView}
variant={variant}
size={size}
options={[
{ value: "day", label: "Day" },
{ value: "week", label: "Week" },
{ value: "month", label: "Month" },
]}
/>
);
}
export default function SegmentedSizesExample() {
return (
<div className="flex flex-col items-center gap-3">
<SegmentedLook variant="solid" size="sm" />
<SegmentedLook variant="solid" size="md" />
<SegmentedLook variant="solid" size="lg" />
</div>
);
}Glass
On a gradient or a photo: the monthly or yearly switch of a pricing hero.
"use client";
import { Segmented } from "@waveinno/ui";
import * as React from "react";
export default function SegmentedGlassExample() {
const [plan, setPlan] = React.useState<"monthly" | "yearly">("yearly");
return (
<div className="rounded-[16px] bg-[linear-gradient(135deg,#1437d3,#7560fd)] p-4">
<Segmented ariaLabel="Billing" value={plan} onChange={setPlan} size="md" variant="glass" options={[{ value: "monthly", label: "Monthly" }, { value: "yearly", label: "Yearly −20%" }]} />
</div>
);
}Full width
Fills its container: for phones and narrow panels.
"use client";
import { Segmented } from "@waveinno/ui";
import * as React from "react";
export default function SegmentedFullExample() {
const [view, setView] = React.useState<"day" | "week" | "month">("week");
return (
<div className="w-full max-w-md">
<Segmented ariaLabel="Period" value={view} onChange={setView} size="md" variant="solid" fullWidth options={[{ value: "day", label: "Day" }, { value: "week", label: "Week" }, { value: "month", label: "Month" }]} />
</div>
);
}Animated#
Motion that earns its place: free ones to copy now, and Pro ones whose code and Figma copy come with a Wavi Pro licence. They respect the visitor's reduced-motion setting.
Pricing switch Pro
The saving pops in and every price rolls to its new number.
Starter
৳1,190/ month
Business
৳3,190/ month
This example's code comes with Wavi Pro
One payment for every Pro component, block and template, with every update.
Import#
Everything comes from the package root. The example above uses:
import { Segmented } from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<Segmented>
src/components/ui/segmented.tsx| Prop | Type | Default | Description |
|---|---|---|---|
valuerequired | T | — | |
onChangerequired | (v: T) => void | — | |
optionsrequired | SegmentedOption<T>[] | — | |
className | string | — | |
ariaLabel | string | — | |
variant | keyof typeof TRACK | "pill" | |
size | keyof typeof SIZES | "sm" | |
fullWidth | boolean | false | Stretch to the container, options sharing the width equally. |
Install#
If the project does not have the package yet, add it, then follow the setup for Next.js or Vite once.
$ npm install @waveinno/ui