# Sales Forecast

> The quarter's forecast: quota, won, commit and best case on top, then the forecast by rep or by month against the quota line.

Pattern · Pro kit · [Live page](https://ui.twentyfirst.media/pro/patterns/SalesForecastScreen/)

The quarter's forecast: quota, won, commit and best case on top, then the forecast by rep or by
month against the quota line.

## Code

```tsx
import * as React from "react";
import {
  AppShell,
  Forecast,
  PageHeader,
  Panel,
  Segmented,
  Stagger,
  StatTile,
} from "@twentyfirstmedia/pro";
import { CRM_NAV } from "./_crm";
import { REPS } from "./_sales";

/** The quarter's forecast: quota, won, commit and best case per rep and per month. */
export default function Preview() {
  const [view, setView] = React.useState("reps");
  return (
    <AppShell
      navigation="sidebar"
      brand="Pilot CRM"
      sidebarGroups={CRM_NAV}
      active="forecast"
      user={{ name: "Mara Ellis", email: "mara@pilot.app" }}
      dock={false}
    >
      <div className="tf-in">
        <PageHeader
          title="Forecast"
          subtitle="Q4 2026 · New business"
          actions={[
            <Segmented
              key="view"
              label="Group by"
              value={view}
              onChange={setView}
              options={[
                { value: "reps", label: "Reps" },
                { value: "months", label: "Months" },
              ]}
            />,
          ]}
        />
      </div>
      <Stagger className="tf-col" style={{ gap: 16 }}>
        <div
          className="tf-grid"
          style={
            {
              "--cols": "repeat(2, minmax(0, 1fr))",
              "--cols-sm": "repeat(2, minmax(0, 1fr))",
              gap: 16,
            } as React.CSSProperties
          }
        >
          <StatTile label="Quota" value="€300,000" tint="butter" />
          <StatTile label="Won" value="€251,500" tint="mint" delta="84%" />
          <StatTile label="Commit" value="€46,000" tint="sky" />
          <StatTile label="Best case" value="€52,000" tint="lilac" />
        </div>
        <Panel title={view === "reps" ? "By rep" : "By month"} subtitle="The line marks the quota">
          {view === "reps" ? (
            <Forecast rows={REPS} />
          ) : (
            <Forecast
              rows={[
                { id: "oct", name: "October", quota: 100000, won: 108500, commit: 0, bestCase: 0 },
                {
                  id: "nov",
                  name: "November",
                  quota: 100000,
                  won: 92000,
                  commit: 14000,
                  bestCase: 12000,
                },
                {
                  id: "dec",
                  name: "December",
                  quota: 100000,
                  won: 51000,
                  commit: 32000,
                  bestCase: 40000,
                },
              ]}
            />
          )}
        </Panel>
      </Stagger>
    </AppShell>
  );
}
```

## Props

### AppShell

| Prop | Type | Notes |
| --- | --- | --- |
| `active?` | `string` |  |
| `brand?` | `ReactNode` | The product name, or a node (a logo mark with the name; collapsed sidebars show it whole). |
| `brandDot?` | `boolean` | The status dot after the brand (default `true`); turn it off next to a logo of your own. |
| `tag?` | `string` |  |
| `nav?` | `NavItem[]` |  |
| `user?` | `{ name: string; email?: string }` |  |
| `onNavigate?` | `(label: string) => void` |  |
| `topExtra?` | `ReactNode` |  |
| `sheetStyle?` | `CSSProperties` |  |
| `contentKey?` | `string \| number` |  |
| `side?` | `ReactNode` |  |
| `dock?` | `boolean` |  |
| `dockItems?` | `DockProps["items"]` |  |
| `railTop?` | `RailItem[]` |  |
| `railBottom?` | `RailItem[]` |  |
| `fill?` | `boolean` | The shell is the whole page: at least the viewport's height (100dvh), no outer radius, the sheet fills the rest; on desktop the sidebar stays in view while the page scrolls, on phones the sheet starts right under the sidebar's bar. |
| `navigation?` | `"top" \| "sidebar"` |  |
| `sidebarGroups?` | `SidebarGroup[]` | With `navigation="sidebar"`: groups instead of the flat `nav` list. |
| `sidebar?` | `Partial<Omit<SidebarProps, "variant" \| "groups">>` | With `navigation="sidebar"`: more sidebar props (collapsed, storageKey, shortcut, linkAs …). |
| `workspaces?` | `WorkspaceSwitcherProps` | With `navigation="sidebar"`: the workspace switcher at the top instead of the brand. |
| `userMenu?` | `(MenuItem \| "-")[]` | The account menu's entries (with `navigation="sidebar"` at the foot of the sidebar). |
| `topbar?` | `boolean \| ReactNode` | With `navigation="sidebar"`: a bar across the top of the frame. The brand (or `workspaces`) moves into its start, as wide as the sidebar below it (expanded or collapsed); `topStart` follows it, `topEnd` sits at the end. Frame, bar and sidebar read as one L around the sheet. Content given here goes between `topStart` and `topEnd`. On phones the bar is the sidebar's bar (menu button and brand) with `topEnd` on the right and `topStart` behind an icon button. |
| `topStart?` | `ReactNode` | With `topbar`: right after the brand, e.g. a search field or a command palette trigger. |
| `topEnd?` | `ReactNode` | With `topbar`: at the end of the bar (buttons, menus); `topExtra` goes there too. |
| `topStartCompact?` | `ReactNode` | With `topbar` on phones: what stands in for `topStart` (default: an icon button that opens `topStart` over the bar). |
| `topStartIcon?` | `IconName` | The icon of that button (default `search`). |
| `topStartLabel?` | `string` | The accessible name of that button (default "Search"). |
| `children?` | `ReactNode` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Forecast

| Prop | Type | Notes |
| --- | --- | --- |
| `rows` | `ForecastRow[]` | Required |
| `currency?` | `string` |  |
| `total?` | `boolean` | Adds a total row (default when there is more than one row). |
| `label?` | `string` | Accessible name (default "Forecast"). |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### PageHeader

| Prop | Type | Notes |
| --- | --- | --- |
| `crumbs?` | `(string \| Crumb)[]` | A breadcrumb above the title (see `Breadcrumb`): labels, or items with `href`/`onClick`. |
| `crumbLinkAs?` | `ElementType` | The element crumb links render as, e.g. Next.js `Link`. |
| `title` | `string` | Required |
| `subtitle?` | `string` |  |
| `actions?` | `ReactNode[]` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Panel

| Prop | Type | Notes |
| --- | --- | --- |
| `side?` | `boolean` |  |
| `title?` | `string` |  |
| `subtitle?` | `string` |  |
| `action?` | `ReactNode` |  |
| `children?` | `ReactNode` |  |
| `surface?` | `Surface` | `"glass"`: translucent glass over what is behind (maps, 3D, video, photos); `"solid"` opts out inside a glass `UIProvider`. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Segmented

| Prop | Type | Notes |
| --- | --- | --- |
| `options` | `(string \| Option)[]` | Required |
| `value?` | `string` |  |
| `defaultValue?` | `string` |  |
| `onChange?` | `(v: string) => void` |  |
| `size?` | `"sm"` |  |
| `block?` | `boolean` |  |
| `label?` | `string` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### StatTile

| Prop | Type | Notes |
| --- | --- | --- |
| `value` | `ReactNode` | Required |
| `label` | `string` | Required |
| `tint?` | `Tint \| "surface" \| "placeholder"` |  |
| `delta?` | `string` |  |
| `delay?` | `number` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
