Stepper
Stepper for a useful, keyboard-friendly product interface.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/stepper.jsonUse it
Scroll horizontally for long lines
"use client";
import {Stepper} from '@/components/jez-ui/ui/stepper';
export default function Example(){
return <><div className="w-full max-w-sm"><div className="mb-7"><h3 className="text-2xl tracking-tight">One thing at a time.</h3><p className="mt-2 text-sm leading-relaxed text-muted-foreground">A few small steps to make yourself at home.</p></div><Stepper steps={['Your details','Workspace','Ready']} current={1}/></div></>;
}Props & types
Scroll horizontally for long lines
{
steps: string[];
current: number;
className?: string;
}Source
View 2 source files
registry/ui/stepper.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Stepper({
steps,
current,
className,
}: {
steps: string[];
current: number;
className?: string;
}) {
return (
<ol className={cn("flex flex-wrap gap-5", className)}>
{steps.map((s, i) => (
<li
key={s}
aria-current={i === current ? "step" : undefined}
className="flex items-center gap-2 text-sm"
>
<span
className={cn(
"flex size-7 items-center justify-center rounded-full text-xs",
i <= current ? "bg-primary text-primary-foreground" : "bg-muted",
)}
>
{i + 1}
</span>
<span
className={i === current ? "font-medium" : "text-muted-foreground"}
>
{s}
</span>
</li>
))}
</ol>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →