Steps

Numbered steps joined by a rail that fades out at the end.

  1. Create an account

    Sign up with your email and confirm the link we send you.

  2. Set up your workspace

    Give it a name, pick a region and choose who can join.

  3. Invite your team

    Add teammates by email and choose a role for each.

Installation

CLI

pnpm dlx shadcn@latest add @riff/steps

Manual

  1. Copy the component

    Save this as components/ui/steps.tsx:

    import type { ReactNode } from 'react';
    import './steps.css';
    
    /** Numbered steps joined by a rail, for setup guides and walkthroughs. */
    export function Steps({ children }: { children: ReactNode }) {
      return <ol className="riff-steps">{children}</ol>;
    }
    
    /** One step: its title beside the number, then any content. */
    export function Step({
      title,
      children,
    }: {
      title: ReactNode;
      children?: ReactNode;
    }) {
      return (
        <li className="riff-step">
          <p className="riff-step-title">{title}</p>
          {children && <div className="riff-step-body">{children}</div>}
        </li>
      );
    }
  2. Copy its styles

    Save this beside it as steps.css:

    /* Host roles first, system colours after: the component reads your theme
       when it has these properties and stays legible when it does not. Each step
       draws the rail from its number to the next, with the same gap at both
       ends; the last step's rail fades out over its final 96px. */
    @layer components {
      .riff-steps {
        --riff-step-rail: calc(-1.75rem - 0.5px);
        --riff-step-gap: 0.375rem;
        --riff-step-tint: var(
          --color-border,
          color-mix(in srgb, currentColor 15%, transparent)
        );
        counter-reset: riff-step;
        margin: 1.5em 0 1.5em 0.75rem;
        padding: 0 0 0 1.75rem;
        list-style: none;
      }
      .riff-step {
        position: relative;
        counter-increment: riff-step;
        margin: 0;
        padding: 0 0 0.75rem;
        &::before {
          content: counter(riff-step);
          position: absolute;
          top: 0;
          left: calc(var(--riff-step-rail) - 0.75rem);
          display: grid;
          width: 1.5rem;
          height: 1.5rem;
          place-items: center;
          border: 1px solid var(--riff-step-tint);
          border-radius: 999px;
          background-color: var(--color-background, Canvas);
          color: var(--color-foreground, CanvasText);
          font-size: 0.75rem;
          font-weight: 600;
          font-variant-numeric: tabular-nums;
          line-height: 1;
        }
        &::after {
          content: '';
          position: absolute;
          top: calc(1.5rem + var(--riff-step-gap));
          bottom: var(--riff-step-gap);
          left: var(--riff-step-rail);
          width: 1px;
          background-color: var(--riff-step-tint);
        }
        &:last-child {
          padding-bottom: 0;
          &::after {
            bottom: 0;
            background: linear-gradient(
              to top,
              transparent,
              var(--riff-step-tint) min(100%, 6rem)
            );
          }
        }
      }
      .riff-step-title {
        margin: 0 0 0.25rem;
        color: var(--color-foreground, CanvasText);
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.5rem;
      }
      .riff-step-body {
        color: var(--color-muted-foreground, GrayText);
        & > :first-child {
          margin-top: 0;
        }
        & > :last-child {
          margin-bottom: 0;
        }
      }
      @media (max-width: 39.999rem) {
        .riff-steps {
          --riff-step-rail: calc(-1.5rem - 0.5px);
          margin-inline-start: 0.625rem;
          padding-inline-start: 1.5rem;
        }
      }
    }

Usage

import { Step, Steps } from '@/components/ui/steps';

<Steps>
  <Step title="Install">Run the installer.</Step>
  <Step title="Configure">Add your keys.</Step>
</Steps>;

Steps number themselves and the rail joins each number to the next. Put anything in a step, including code blocks. In MDX, map Steps and Step as components and write Markdown inside.

Props

PropTypeDefaultDescription
Steps.childrenReactNodeThe Step elements.
Step.titleReactNodeBeside the number.
Step.childrenReactNodeThe step’s content.