# Pipeline

> Deals in columns per stage, each column with its count, total and weighted value (value times the stage's probability).

Component · CRM · Halo kit · [Live page](https://ui.twentyfirst.media/halo/components/Pipeline/)

Deals in columns per stage, each column with its count, total and weighted value (value times the
stage's probability).

- Deals move by drag and drop or by each card's "Move to" menu; both call `onMove(id, stage)`.
- On narrow screens the columns scroll sideways inside the pipeline, never the page.

## Example

```tsx
import * as React from "react";
import { Pipeline } from "@twentyfirstmedia/halo";
import type { PipelineStage } from "@twentyfirstmedia/halo";
import { STAGES } from "./_crm";

export default function Preview() {
  const [stages, setStages] = React.useState<PipelineStage[]>(STAGES);
  return (
    <Pipeline
      stages={stages}
      onOpen={() => {}}
      onMove={(id, to) =>
        setStages((all) => {
          const deal = all.flatMap((s) => s.deals).find((d) => d.id === id);
          if (!deal) return all;
          return all.map((s) => ({
            ...s,
            deals:
              s.id === to
                ? [{ ...deal, daysInStage: 0 }, ...s.deals.filter((d) => d.id !== id)]
                : s.deals.filter((d) => d.id !== id),
          }));
        })
      }
    />
  );
}
```

## Props

### Pipeline

| Prop | Type | Notes |
| --- | --- | --- |
| `stages` | `PipelineStage[]` | Required |
| `currency?` | `string` |  |
| `staleAfter?` | `number` |  |
| `onOpen?` | `(id: string) => void` |  |
| `onMove?` | `(dealId: string, stageId: string) => void` | Moving a deal: by drag and drop, or from the card's "Move to" menu with the keyboard. |
| `label?` | `string` | Accessible name (default "Pipeline"). |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
