Opportunity Card
An opportunity in a contact's column of the opportunity workspace: the matter type with its stage dot, the staff on it and its matter number. Selected, the border and title take the stage colour and the details open below. The card is one button; the staff avatars beside it stay their own control.
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 { OpportunityCard } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
Props
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Pass the same stage the Pipeline shows (label, icon and tone), so the card and the pipeline read the same. |
| Do | Move the selection in one render: clear selected on one card and set it on the next together, so the closing details and the opening ones trade height and the column holds still. |
| Do | Set conflictCheck while a conflict check is still required. The shield is drawn and also said in the card's accessible name. |
| Do | Put the rows a lawyer needs on the selected card, like Created, Created by and Last updated, in details. The matter number and age fade out while the card is selected. |
| Don't | Put a button or link in details or beside the title. The card's button covers the whole card; only the staff avatars sit above it as their own control. |
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title * | string | — | The matter type, like "Divorce". |
| stage * | { label: string; /** A 12 px icon in the stage colour, as on the Pipeline. */ icon: ReactNode; tone: StageTone; } | — | The pipeline stage: its label, icon and tone, as on the Pipeline. |
| reference | string | — | The LEAP matter number, like "CRM/1042". |
| age | ReactNode | — | How long ago it was opened, already formatted, like "11 hours ago". |
| staff | AvatarItem[] | [] | The staff on it, as small avatars. |
| conflictCheck | boolean | false | Shows the shield: a conflict check is still required. |
| selected | boolean | false | Selected: the border and title take the stage colour and the details open below. |
| details | unknown | [] | Rows shown while selected, like Created, Created by and Last updated. |
| onSelect | () => void | — | Selects the opportunity in the workspace. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
Code
What the playground shows, ready to copy.
import { OpportunityCard } from "@leap-crm/design-system";
<OpportunityCard title="Divorce" reference="CRM/1042" conflictCheck stage={stage} staff={staff} details={details} />In a column
Press a card to select it: the border and title take its stage colour and Created, Created by and Last updated open below. Hover for the subtle fill; Tab for the focus border and halo. A long matter type truncates and shows in full on hover.
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
Details coming and going
Selecting the card opens its space on the resize curve and the details cascade in, a beat apart, all in place in about 300 ms however many there are. A detail added while it's open opens its own row and turns in; one removed fades before its row closes. Deselecting fades them together, then the card closes up. With reduced motion they fade, with no cascade.
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
- Source
- Website enquiry
- Referred by
- Harbour Lending
- Value
- $12,400
Every stage
The stage dot carries the stage fill and icon; selected, the stage colour edges the card.
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
- Created
- 11 hours ago
- Created by
- Firm Pilot
- Last updated
- Just now
Without a conflict check or staff
The shield shows only while a conflict check is still required.
What the examples share
The imports and the scaffolding the examples above call. The scaffolding lives in this page, not in the library.
import { BookOpenCheck, Calendar, DoorClosedLocked, FileSignature, MessageCircleMore, ShieldCheck } from "lucide-react";
import { useState } from "react";
import { Button, OpportunityCard, type OpportunityCardStage } from "@leap-crm/design-system";
const stages: OpportunityCardStage[] = [
{ label: "Enquiry", icon: <MessageCircleMore />, tone: "info" },
{ label: "Qualifying", icon: <ShieldCheck />, tone: "warning" },
{ label: "Scheduled", icon: <Calendar />, tone: "success" },
{ label: "Agreement", icon: <FileSignature />, tone: "teal" },
{ label: "Active", icon: <BookOpenCheck />, tone: "purple" },
{ label: "Closed", icon: <DoorClosedLocked />, tone: "default" },
];
const staff = [
{ id: "1", name: "Sam Brooks", initials: "SB" },
{ id: "2", name: "Mia Grant", initials: "MG" },
];
const details = [
{ label: "Created", value: "11 hours ago" },
{ label: "Created by", value: "Firm Pilot" },
{ label: "Last updated", value: "Just now" },
];
const card = {
title: "Divorce",
reference: "CRM/1042",
age: "11 hours ago",
staff,
details,
conflictCheck: true,
};
function Column() {
const [selected, setSelected] = useState("Scheduled");
return (
<div className="flex w-72 flex-col gap-2">
{stages.slice(0, 3).map(stage => (
<OpportunityCard
key={stage.label}
{...card}
title={
stage.label === "Enquiry"
? "Family Law – Property Settlement"
: card.title
}
stage={stage}
selected={selected === stage.label}
onSelect={() => setSelected(stage.label)}
/>
))}
</div>
);
}
const moreDetails = [
...details,
{ label: "Source", value: "Website enquiry" },
{ label: "Referred by", value: "Harbour Lending" },
{ label: "Value", value: "$12,400" },
];
function ComingAndGoing() {
const [open, setOpen] = useState(true);
const [withNext, setWithNext] = useState(false);
const shown = withNext
? [...moreDetails, { label: "Next step", value: "Book a consult" }]
: moreDetails;
return (
<div className="flex flex-col gap-3">
<div className="flex gap-2">
<Button
intent="outline"
size="sm"
onClick={() => setOpen(value => !value)}
>
{open ? "Deselect" : "Select"}
</Button>
<Button
intent="ghost"
size="sm"
aria-pressed={withNext}
onClick={() => setWithNext(value => !value)}
>
Next step
</Button>
</div>
<div className="flex w-72 flex-col gap-2">
<OpportunityCard
{...card}
stage={stages[3]!}
details={shown}
selected={open}
onSelect={() => setOpen(true)}
/>
<OpportunityCard {...card} title="Will and estate" stage={stages[0]!} />
</div>
</div>
);
}Keyboard
The keys it answers to. Tab moves between components, arrows move within them.
| Keys | What they do |
|---|---|
| EnterSpace | Select the card: it is one button. |





