Primitives
Steps
circle, glow, card, chevron, bar, dot; horizontal or vertical; finished steps link back; the current step can hold content.
Finished steps are clickable.
circle
- 3RatesWhat cars and bikes pay
- 4Go liveOpen the gates
glow · the current step pulses with light
- 3RatesWhat cars and bikes pay
- 4Go liveOpen the gates
card
- Step 3RatesWhat cars and bikes pay
- Step 4Go liveOpen the gates
chevron
bar
- Step 1
- Step 2
- Step 3RatesWhat cars and bikes pay
- Step 4Go liveOpen the gates
- 3RatesWhat cars and bikes pay
The rates form would be here.
- 4Go liveOpen the gates
- Your siteName and address
- GatesConnect the controllers
- 3RatesWhat cars and bikes pay
- 4Go liveOpen the gates
- Your siteName and address
- GatesConnect the controllers
- RatesWhat cars and bikes pay
- Go liveOpen the gates
steps.tsx
"use client";
import { Button, Steps } from "@waveinno/ui";
import { Building2, DoorOpen, ShieldCheck, Wallet } from "lucide-react";
import * as React from "react";
const SETUP = [
{ title: "Your site", description: "Name and address" },
{ title: "Gates", description: "Connect the controllers" },
{ title: "Rates", description: "What cars and bikes pay" },
{ title: "Go live", description: "Open the gates" },
];
export default function StepsDemo() {
const [step, setStep] = React.useState(2);
return (
<div className="space-y-8">
<div className="flex flex-wrap items-center gap-2">
<Button size="sm" variant="secondary" onClick={() => setStep((s) => Math.max(0, s - 1))}>
Back
</Button>
<Button size="sm" onClick={() => setStep((s) => Math.min(SETUP.length, s + 1))}>
{step >= SETUP.length - 1 ? "Finish" : "Next"}
</Button>
<span className="text-[12px] text-muted">Finished steps are clickable.</span>
</div>
<div className="space-y-2">
<p className="text-[12px] text-muted">circle</p>
<Steps steps={SETUP} current={step} onStepClick={setStep} />
</div>
<div className="space-y-2">
<p className="text-[12px] text-muted">glow · the current step pulses with light</p>
<Steps steps={SETUP} current={step} variant="glow" onStepClick={setStep} />
</div>
<div className="space-y-2">
<p className="text-[12px] text-muted">card</p>
<Steps steps={SETUP.map((s, i) => ({ ...s, icon: [<Building2 key="a" />, <DoorOpen key="b" />, <Wallet key="c" />, <ShieldCheck key="d" />][i] }))} current={step} variant="card" onStepClick={setStep} />
</div>
<div className="space-y-2">
<p className="text-[12px] text-muted">chevron</p>
<Steps steps={SETUP} current={step} variant="chevron" onStepClick={setStep} />
</div>
<div className="space-y-2">
<p className="text-[12px] text-muted">bar</p>
<Steps steps={SETUP} current={step} variant="bar" onStepClick={setStep} />
</div>
<div className="grid gap-8 md:grid-cols-2">
<Steps
orientation="vertical"
current={step}
onStepClick={setStep}
steps={SETUP.map((s, i) => ({ ...s, content: i === 2 ? <p className="rounded-[10px] border border-dashed border-border2 p-3 text-[12.5px] text-muted">The rates form would be here.</p> : undefined }))}
/>
<div className="grid grid-cols-2 gap-6">
<Steps orientation="vertical" variant="glow" current={step} steps={SETUP} />
<Steps orientation="vertical" variant="dot" current={step} steps={SETUP} />
</div>
</div>
</div>
);
}Import#
Everything comes from the package root. The example above uses:
your-component.tsx
import { Button, Steps } from "@waveinno/ui";Props#
Read from the source of this version, so they match the code exactly.
<Steps>
src/components/ui/steps.tsx| Prop | Type | Default | Description |
|---|---|---|---|
stepsrequired | StepItem[] | — | |
currentrequired | number | — | Index of the current step, from 0. Equal to steps.length when all are done. |
variant | "circle" | "glow" | "dot" | "bar" | "card" | "chevron" | "circle" | |
orientation | "horizontal" | "vertical" | "horizontal" | |
onStepClick | (index: number) => void | — | Makes finished steps clickable. |
className | string | — |
<Button>
src/components/ui/button.tsx| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | |
loading | boolean | — |
Also takes ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants>.
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