Workflow
A directed workflow laid out in character-art: nodes as boxes stacked in layers, edges drawn between them, and a step-through that walks a path and lights each node as active or done.
Install
pnpm add @fractaldesign/machines-ui import '@fractaldesign/machines-ui/style.css';
import { GraphWorkflow } from '@fractaldesign/machines-ui';Preview
<script lang="ts">
import { GraphWorkflow, type WorkflowNode } from '@fractaldesign/machines-ui';
const nodes: WorkflowNode[] = [
{ id: 'commit', label: 'commit' },
{ id: 'lint', label: 'lint' },
{ id: 'test', label: 'test', hint: 'unit + e2e' },
{ id: 'build', label: 'build' },
{ id: 'publish', label: 'publish' }
];
</script>
<GraphWorkflow title="DEPLOY" autoPlay {nodes} />import { GraphWorkflow, type WorkflowNode, type WorkflowEdge } from '@fractaldesign/machines-ui';
const nodes: WorkflowNode[] = [
{ id: 'push', label: 'push' },
{ id: 'lint', label: 'lint' },
{ id: 'unit', label: 'unit' },
{ id: 'e2e', label: 'e2e' },
{ id: 'build', label: 'build' },
{ id: 'ship', label: 'ship' }
];
const edges: WorkflowEdge[] = [
{ from: 'push', to: 'lint' },
{ from: 'push', to: 'unit' },
{ from: 'push', to: 'e2e' },
{ from: 'lint', to: 'build' },
{ from: 'unit', to: 'build' },
{ from: 'e2e', to: 'build' },
{ from: 'build', to: 'ship' }
];
<GraphWorkflow title="CI DIAMOND" autoPlay {nodes} {edges} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title* | string | — | Caption drawn on the top edge as `[ TITLE ]`. Uppercase, 1–2 words. |
| nodes* | WorkflowNode[] | — | The workflow's nodes; boxes are sized to fit each label and hint. |
| edges | WorkflowEdge[] | — | Explicit edges between node ids; when omitted, the nodes link into a chain in list order. |
| path | string[] | — | Node ids in the order the playthrough visits them; defaults to a topological order. |
| animated | boolean | true | Enable the step transitions; reduced motion freezes the first step. Default true. |
| autoPlay | boolean | false | Start stepping through the path on mount. Default false. |
| speedMs | number | 1200 | Milliseconds between path steps; adjustable with the speed slider. Default 1200. |
| showControls | boolean | true | Show the prev/play/next buttons, step dots, and speed slider. Default true. |
| label | string | — | Short caption under the diagram; omitted entirely when not set. |
| corner | string | — | Character drawn at each corner of the frame. |
| class | string | '' |
API
- class forwarded to the outer element
- motion runs live; set animated={false} to freeze
- a11y honours prefers-reduced-motion
Types
| Name | Kind | Description |
|---|---|---|
| WorkflowTone | type | 'default' | 'accent' | 'muted' |
| WorkflowNode | interface | |
| WorkflowEdge | interface | |
| Cell | type | { ch: string; cls?: string } |
| Seg | type | { text: string; cls?: string } |
Theming
CSS custom properties this component reads.
- --border
- --graph-accent
- --text-muted
- --text-primary
- --text-secondary
Related
Built from
src/lib/components/animated/GraphWorkflow.svelte