Steps

Numbered steps joined by a hairline.

  1. 1

    Get your API key

    Sign up and copy it from the dashboard.

  2. 2

    Call one endpoint

    Pass a URL and the options you need.

  3. 3

    Get the file back

    As a response or a signed link.

Install

$ npx shadcn@latest add @nudgekit/steps

Or with no config: npx shadcn@latest add https://ui.nudgekit.app/r/steps.json

Usage

usage.tsx
import { Steps } from "@/components/steps"

<Steps steps={[
  { title: "Get your API key", description: "Sign up and copy it." },
  { title: "Call one endpoint" },
  { title: "Get the file back" },
]} />

Do

  • Use three or four steps.

Don't

  • Use more than five steps.

Code

What the CLI writes into your project. It is yours to change.

components/steps.tsx
import * as React from "react";

import { cn } from "@/lib/utils";

export interface StepsProps {
  steps: { title: string; description?: string }[];
  className?: string;
}

/** Numbered steps joined by a hairline. */
function Steps({ steps, className }: StepsProps) {
  return (
    <ol data-slot="steps" className={cn("list-none p-0", className)}>
      {steps.map((s, i) => (
        <li key={s.title} className="relative pb-6 pl-12 last:pb-0">
          <span className="absolute left-0 top-[-2px] grid size-7 place-items-center rounded-full border border-line-strong bg-background font-mono text-xs font-medium text-brand-ink">
            {i + 1}
          </span>
          {i < steps.length - 1 && <span aria-hidden className="absolute bottom-0.5 left-3.5 top-[30px] w-px bg-border" />}
          <p className="text-base font-medium text-foreground">{s.title}</p>
          {s.description && <p className="mt-1 text-sm leading-relaxed text-muted-foreground">{s.description}</p>}
        </li>
      ))}
    </ol>
  );
}

export { Steps };