Workspace Overview

The parts of the opportunity and contact workspace's Overview: a section head with its count, View all and action; task rows; the overflow link under a cut-short list; and note cards.

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 { WorkspaceSectionHeader, WorkspaceTaskRow, WorkspaceOverflowLink, WorkspaceNoteCard } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

Tasks

3

Props

title
count
headingLevel
icon

Best practices

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

GuidancePractice
DoHead each Overview section with WorkspaceSectionHeader, with its count, onViewAll and action, like Add or Log. Set headingLevel to fit the page's outline.
DoRender WorkspaceOverflowLink only when a list is cut short, with what's hidden, like “Showing 3 of 5 tasks”.
DoWord a task's due so it reads without colour, like “Overdue by 2 days”. urgent only turns it red.
DoPass onPinnedChange to a WorkspaceNoteCard only where the reader can pin notes. Without it the pin isn't shown.
Don'tUse WorkspaceTaskRow where tasks edit in place or move when ticked. Use TaskList, which sorts by due date and moves ticked tasks to Done.

Props

WorkspaceSectionHeader

PropTypeDefaultDescription
icon *ReactNode—A 16 px icon for the section, like a checked square for tasks.
title *string—The section's name, like "Tasks".
countnumber0How many there are. The count shows only above 0.
onViewAll() => void—Opens the whole list. Shows "View all" as a small link.
action{ label: string; onClick: () => void; icon?: ReactNode }—The section's action, as an outline button with a +, like Add, Log or Upload.
headingLevel"h2" | "h3" | "h4""h3"The heading level in its page.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

WorkspaceTaskRow

PropTypeDefaultDescription
title *string—The task.
donebooleanfalseWhether it's done: the box is ticked and the title struck through.
onDoneChange(done: boolean) => void—Runs when the box is ticked or cleared.
priority"low" | "medium" | "high" | "urgent" | "critical"—Shows the priority bars when set.
duestring—When it's due, already worded, like "Due in 6 days".
urgentbooleanfalseOverdue or due today: the due date turns red.
assigneePerson | null—Who it's assigned to. Unassigned shows the person icon.
actionsReactNode—The row's actions, like a ⋯ menu, always visible.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

WorkspaceOverflowLink

PropTypeDefaultDescription
children *ReactNode—What's hidden, like "Showing 3 of 5 tasks".
onClick *() => void—Opens the whole list.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

WorkspaceNoteCard

PropTypeDefaultDescription
title *string—The note's first line.
body *string—The note, clipped to two lines; the rest shows on hover.
source{ icon: ReactNode; label: string }—What the note came from, like "Phone call", as a small pill above the title. No date: the footer shows it.
author *{ name: string; initials?: string | null; image?: string | null; }—Who wrote it: name, initials and image.
date *string—When it was written, already worded, like "2 days ago".
pinnedbooleanfalsePinned notes stay at the top.
onPinnedChange(pinned: boolean) => void—Runs when the pin is pressed. Without it the pin isn't shown.
actionsReactNode—The note's other actions, like a ⋯ menu.
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Code

What the playground shows, ready to copy.

import { PlusIcon, WorkspaceSectionHeader } from "@leap-crm/design-system";

<WorkspaceSectionHeader title="Tasks" count={3} icon={<PlusIcon />} />

Tasks section

The section head (count above 0, View all, Add), task rows in a bordered list with the last rule dropped, and the overflow link. Tick a task to mark it done. Overdue and due-today dates turn red; an unassigned task shows the person icon. A long title wraps to three lines, then clips and shows in full on hover.

Open tasks

5
Order section 32 vendor statement
Due in 6 days
Chase the bank for the signed loan documents before settlement
Overdue by 2 days
Book the settlement room
Due today

Section heads

No count at 0; View all only when the list can open; the action names what it adds.

Notes

Interactions

12

Note card

160 px: the source pill, the title, two lines of the note (clipped, in full on hover), then the author, date, pin and menu. Press the pin to pin the note.

Phone call

Vendor wants a 60-day settlement

Agent called: the vendor prefers 60 days and will take 45 with a 10% deposit. Rose is fine with either; confirm with her lender before we reply. The bank has asked for the valuation report again, and the strata search is still outstanding.
Sam Evans
2 days ago

What the examples share

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

import { EllipsisVertical, NotebookPen, Phone, SquareCheckBig } from "lucide-react";

import { useState } from "react";

import { IconButton, WorkspaceNoteCard, WorkspaceOverflowLink, WorkspaceSectionHeader, WorkspaceTaskRow } from "@leap-crm/design-system";

const noop = () => undefined;

const more = (label: string) => (
  <IconButton size="xs" icon={<EllipsisVertical />} aria-label={label} />
);

function Tasks() {
  const [done, setDone] = useState<string[]>([]);
  const tasks = [
    {
      id: "1",
      title: "Order section 32 vendor statement",
      priority: "medium" as const,
      due: "Due in 6 days",
      assignee: { name: "Sam Evans", initials: "SE" },
    },
    {
      id: "2",
      title: "Chase the bank for the signed loan documents before settlement",
      priority: "urgent" as const,
      due: "Overdue by 2 days",
      urgent: true,
      assignee: null,
    },
    {
      id: "3",
      title: "Book the settlement room",
      priority: "low" as const,
      due: "Due today",
      urgent: true,
      assignee: { name: "Mia Grant", initials: "MG" },
    },
  ];
  return (
    <div className="flex w-full max-w-3xl flex-col gap-1">
      <WorkspaceSectionHeader
        icon={<SquareCheckBig />}
        title="Open tasks"
        count={5}
        onViewAll={noop}
        action={{ label: "Add", onClick: noop }}
      />
      <div className="border-neutral-border rounded-md border">
        {tasks.map(task => (
          <WorkspaceTaskRow
            key={task.id}
            {...task}
            done={done.includes(task.id)}
            onDoneChange={checked =>
              setDone(ids =>
                checked ? [...ids, task.id] : ids.filter(id => id !== task.id),
              )
            }
            actions={more(`More actions for ${task.title}`)}
          />
        ))}
      </div>
      <WorkspaceOverflowLink onClick={noop}>
        Showing 3 of 5 tasks
      </WorkspaceOverflowLink>
    </div>
  );
}

function Note() {
  const [pinned, setPinned] = useState(false);
  return (
    <div className="w-full max-w-3xl">
      <WorkspaceNoteCard
        title="Vendor wants a 60-day settlement"
        body="Agent called: the vendor prefers 60 days and will take 45 with a 10% deposit. Rose is fine with either; confirm with her lender before we reply. The bank has asked for the valuation report again, and the strata search is still outstanding."
        source={{ icon: <Phone />, label: "Phone call" }}
        author={{ name: "Sam Evans", initials: "SE" }}
        date="2 days ago"
        pinned={pinned}
        onPinnedChange={setPinned}
        actions={more("More actions for this note")}
      />
    </div>
  );
}

Keyboard

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

KeysWhat they do
TabMoves through its links, buttons and checkboxes in order.
EnterFollows the focused link.
EnterSpacePresses the focused button.
SpaceTicks the focused checkbox.