CaseMap
The use-case map of a product, drawn as a constellation: every point of light is something a person can do, every line a flow between them. A pulse follows one journey.
import { CaseMap, CaseMapSkeleton } from '@sypnia/ui/react'
A bakery
The use cases, in words
- Publish the menu of the day → See the menu of the day
- See the menu of the day → Place an order
- See the sales of the day
- Place an order → Hear about an order and Follow my order
- Hear about an order → Mark an order as ready and See the sales of the day
- Mark an order as ready → Follow my order
- Follow my order
Leave a review: out of the map
Chosen: Place an order
Code
import { useState } from 'react';
import { CaseMap } from '@sypnia/ui/react';
// The use cases of a bakery. The pulse follows one customer; the dim point is a request outside the map.
// Press a case to choose it.
const cases = [
{ id: 'publish', name: 'Publish the menu\nof the day', x: 440, y: 60 },
{ id: 'menu', name: 'See the menu\nof the day', x: 150, y: 118 },
{ id: 'sales', name: 'See the sales\nof the day', x: 580, y: 150 },
{ id: 'order', name: 'Place an order', x: 292, y: 214, focal: true },
{ id: 'notice', name: 'Hear about\nan order', x: 478, y: 252 },
{ id: 'ready', name: 'Mark an order\nas ready', x: 552, y: 372 },
{ id: 'follow', name: 'Follow my order', x: 292, y: 382 },
{ id: 'review', name: 'Leave a review', x: 92, y: 300, out: true },
];
const edges = [
{ from: 'publish', to: 'menu', bend: -0.18 }, { from: 'menu', to: 'order', bend: 0.16 }, { from: 'order', to: 'notice', bend: -0.12 },
{ from: 'notice', to: 'ready', bend: 0.14 }, { from: 'ready', to: 'follow', bend: 0.12 }, { from: 'order', to: 'follow', bend: -0.22 },
{ from: 'notice', to: 'sales', bend: -0.2 },
];
export default function Bakery() {
const [chosen, setChosen] = useState<string | null>('order');
return (
<div className="sy-stack">
<CaseMap label="Use cases of La Espiga, a bakery" cases={cases} edges={edges} journey={['menu', 'order', 'notice', 'ready', 'follow']}
actors={{ start: 'Customer', end: 'Bakery' }} selected={chosen} onSelect={setChosen} />
<p className="sy-text--muted">Chosen: <b>{cases.find((c) => c.id === chosen)?.name.replace('\n', ' ')}</b></p>
</div>
);
} In Astro
The use cases, in words
- Book an appointment → Get a reminder
- Get a reminder → Check in
- Check in
Pay online: outside the scope
Code
---
// The Astro twin, for landing pages and docs: no JavaScript, the same map and the same words.
import CaseMap from '@sypnia/ui/astro/CaseMap.astro';
---
<CaseMap label="Use cases of a clinic" width={520} height={300} idPrefix="clinic" actors={{ start: 'Patient', end: 'Clinic' }}
cases={[
{ id: 'book', name: 'Book an\nappointment', x: 120, y: 110, focal: true },
{ id: 'remind', name: 'Get a reminder', x: 300, y: 70 },
{ id: 'attend', name: 'Check in', x: 400, y: 190 },
{ id: 'pay', name: 'Pay online', x: 200, y: 240, out: true, note: 'outside the scope' },
]}
edges={[{ from: 'book', to: 'remind', bend: -0.15 }, { from: 'remind', to: 'attend', bend: 0.18 }]}
journey={['book', 'remind', 'attend']} /> Skeleton
The use cases, in words
- Write a post → Read a post
- Read a post → Comment
- Comment
Code
import { CaseMap, CaseMapSkeleton } from '@sypnia/ui/react';
// A small map and its skeleton: the frame of the map at its shape.
export default function Skeleton() {
return (
<div className="sy-cols sy-cols--stack">
<CaseMap label="Use cases of a blog" width={420} height={300} cases={[
{ id: 'write', name: 'Write a post', x: 110, y: 90, focal: true }, { id: 'read', name: 'Read a post', x: 300, y: 150 }, { id: 'comment', name: 'Comment', x: 160, y: 230 },
]} edges={[{ from: 'write', to: 'read', bend: 0.12 }, { from: 'read', to: 'comment', bend: -0.15 }]} journey={['write', 'read', 'comment']} />
<CaseMapSkeleton width={420} height={300} />
</div>
);
} When to use it
Use it when
- Explaining what a product does, from the side of the people who use it.
- Showing a request that is outside the map: a scope error.
Do not use it when
- Steps of one process with arrows and labels: use FlowDiagram.
For everyone
- The map is always told in words: each case and where it leads.
- With
onSelecteach case is a button; Enter or Space chooses it. - The pulse stops for people who ask for less motion.
Props
| CaseMap | Type | Default |
|---|---|---|
casesrequired | UseCase[] | |
edgesrequired | CaseEdge[] | |
labelrequiredWhat the map is: «Use cases of La Espiga». | string | |
actorsWho acts, written in the corners: { start: 'Customer', end: 'Bakery' }. | { start?: string; end?: string; } | undefined | |
height | number | 470 |
journeyCase ids in order: the pulse travels along them. Each pair must be an edge. | string[] | [] |
onSelect | ((id: string) => void) | |
selected | string | null | |
widthThe map's own units. Positions of the cases are in these. | number | 640 |
| CaseMapSkeleton | Type | Default |
|---|---|---|
height | number | 470 |
width | number | 640 |