Pipeline

Where an opportunity is in its pipeline: a circle per stage, the current one open into a pill with its name. Every stage is a button with a rich tooltip saying what it means and how long was spent there. With onStageChange, pressing a stage moves there and an unreached stage previews its colours on hover.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

LEAP CRMBuilt for the CRM from the core library. It knows about the CRM's own records, so it isn't a general building block.

import { Pipeline } from "@leap-crm/design-system";

Movable

Press a stage to move there: the pill closes and the new one opens while the connectors between them fill with colour one after another, or drain back when you move back. Hover an unreached stage to preview its colours; Tab through for the tooltips.

Each stage current

Every stage up to the current one is visited, in its own colour, and the connectors between two visited stages fade from one colour to the next.

Lost and disqualified

An opportunity that leaves the run keeps the stages it reached, and the way out opens into the pill.

Read only

Without onStageChange the stages only show where things are: no hover preview, no Click to change hint.

What the examples share

The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.

import { BadgeX, Ban, BookOpenCheck, Calendar, DoorClosedLocked, FileSignature, MessageCircleMore, ShieldCheck } from "lucide-react";

import { useState } from "react";

import { Pipeline, type PipelineStage } from "@leap-crm/design-system";

const stages: PipelineStage[] = [
  {
    id: "enquiry",
    label: "Enquiry",
    icon: <MessageCircleMore />,
    tone: "info",
    description: "New enquiry, awaiting qualification",
    time: "2d 4h",
  },
  {
    id: "qualifying",
    label: "Qualifying",
    icon: <ShieldCheck />,
    tone: "warning",
    description: "Checking conflicts and whether the firm can take the matter",
    time: "1d 2h",
  },
  {
    id: "scheduled",
    label: "Scheduled",
    icon: <Calendar />,
    tone: "success",
    description: "Initial consultation booked",
    time: "21d 6h",
  },
  {
    id: "agreement",
    label: "Agreement",
    icon: <FileSignature />,
    tone: "teal",
    description: "Costs agreement sent for signing",
  },
  {
    id: "active",
    label: "Active",
    icon: <BookOpenCheck />,
    tone: "purple",
    description: "Client engaged the firm, work on the matter has started",
  },
  {
    id: "closed",
    label: "Closed",
    icon: <DoorClosedLocked />,
    tone: "default",
    description: "The matter is finished",
  },
];

const endings: PipelineStage[] = [
  {
    id: "lost",
    label: "Lost",
    icon: <BadgeX />,
    tone: "destructive",
    description: "The client went elsewhere",
  },
  {
    id: "disqualified",
    label: "Disqualified",
    icon: <Ban />,
    tone: "plum",
    description: "The firm can't take the matter",
  },
];

function MovablePipeline() {
  const [current, setCurrent] = useState("scheduled");
  return (
    <Pipeline
      stages={stages}
      endings={endings}
      current={current}
      onStageChange={setCurrent}
    />
  );
}

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoPut the ways out of the run, like Lost and Disqualified, in endings, so they sit after a divider and the stages read forward.
DoName stages in the region's terms (Enquiry or Lead, Agreement or Engagement) and give each a description and time, so its tooltip says what the stage means and how long was spent there.
DoPass onStageChange only where the lawyer may move the opportunity. Without it the pipeline only shows where things are.
DoSet aria-label, like “Opportunity stage”, so screen readers know what the stages belong to.
Don'tUse it for the steps of a setup flow. Use StepHeader; Pipeline shows where an opportunity stands.

Props

PropTypeDefaultDescription
stages *unknown—The run of stages, joined by connectors, in order.
endingsunknown[]Ways out of the run, like Lost and Disqualified: after a 16 px gap, split by a divider.
currentstring | nullnullThe stage it's at now. It opens into a pill with its name.
visitedunknown—Stages reached. By default every stage up to the current one.
onStageChange(id: string) => void—Makes every other stage pressable, to move there. Without it the pipeline only shows where things are.
aria-labelstring"Pipeline"Names the pipeline for screen readers.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
TabMoves from stage to stage; a stage's tooltip shows when focus reaches it.
EnterSpaceChoose the focused stage.
EscapeCloses the stage's tooltip.