Flow: per-connector styling, wrapping layout, and standalone Flow.Node
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- react, typescript
Research direction
Start in packages/kumo/src/components/flow/ and read FlowDiagram, Flow.Node, and useDescendantsContext to understand node registration and connector geometry. First choose and scope one of the three proposed enhancements; done means the selected behavior and API work without breaking existing Flow usage.
Written by the indexing model from the issue text.
Description
Summary
Flow is a great fit for linear/parallel workflow diagrams, but its node and connector rendering are tightly coupled, which blocks a class of "labelled ladder" diagrams: sequences where each connector carries semantic meaning (colour/direction) and where the diagram should wrap rather than pan. Today the only escape hatch is to abandon Flow entirely and hand-roll connectors.
This issue proposes three related enhancements so Flow can cover these cases natively.
Motivating use case
We have a "tier ladder" in an internal admin tool: the rate plans in a product family shown left-to-right as an upgrade/downgrade path. The connectors are the information, not just decoration:
- Green connector: the path from the lowest tier up to the account's currently-active tier ("already traversed").
- Red, reversed connector: a downgrade candidate.
- Neutral connector: everything else.
The ladder also lives in a dense, narrow column, so it wraps into rows of three with a "continues below" down-connector, rather than panning horizontally.
We evaluated migrating this to Flow and could not, for the reasons below.
Current limitations (v2.6.0)
-
Connectors are owned entirely by
<Flow>and expose no per-connector styling. Connector geometry is computed inFlowDiagramfrom registered node rects; the only per-node knob that reaches a connector isdisabled(greys it). There is no supported way to say "the connector arriving at / leaving this node is red" or "this connector points the other way". (Seepackages/kumo/src/components/flow/.) -
Flow.Nodecannot be used outside<Flow>.Flow.NodecallsuseDescendantsContext, which throwsuseDescendantsContext must be used within DescendantsProviderwhen there is no<Flow>ancestor. So consumers cannot reuse just the node presentation while composing their own connectors. -
Layout is single-line + pan only; no wrapping mode. When a horizontal diagram overflows its container it pans. There is no row-wrapping layout for dense/narrow containers.
The net effect: Flow is all-or-nothing. If you need any per-connector semantics or a wrapping layout, you must drop Flow and reimplement connectors by hand, losing the component's measurement/anchor machinery.
Proposed enhancements
Any one of these would help; ideally 1 + 3.
-
Per-connector styling API. For example, a
connectorprop onFlow.Node(styling the incoming edge) or arenderConnector/connectorVariantprop onFlow/Flow.Parallel:<Flow> <Flow.Node>Tier 1</Flow.Node> <Flow.Node connector={{ variant: 'success' }}>Tier 2 (active)</Flow.Node> <Flow.Node connector={{ variant: 'danger', direction: 'reverse' }}>Tier 3 (downgrade)</Flow.Node> </Flow>A small set of semantic variants (
default | success | danger | muted) that map to Kumo tokens would cover most cases; a render prop would cover the rest. -
Wrapping layout mode. An opt-in
layout="wrap"(orwrap/columns) onFlowthat flows nodes into rows when they exceed the container width, with connectors drawn per-row and an inter-row indicator, as an alternative tocanvaspanning. -
Standalone
Flow.Nodepresentation. LetFlow.Noderender its styled body when there is noDescendantsProvider(no-op the connector registration) instead of throwing, so the node's look-and-feel can be reused while a consumer composes connectors themselves. This decouples node presentation from the connector engine.
Why native support is preferable
Hand-rolling connectors means reimplementing getBoundingClientRect tracking, ResizeObserver, scroll/resize remeasurement, and anchor bookkeeping that Flow already does well. Exposing a thin styling/layout seam would let these semantic-ladder diagrams stay on Flow and benefit from that machinery.
Happy to help prototype the connector-styling seam if the direction sounds reasonable.
- Dominant language
- TypeScript
- Stars
- 4k
- Forks
- 184
- Avg merge
- 22h 44m
- Merged PRs (30d)
- 52
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/kumo
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/kumo#863 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudflare/kumo#862 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/kumo#860 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/kumo#861 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
cloudflare/kumo#859 ·
Maintainers usually reply within 1 day
Similar issues
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
maniator/verticopolis#880 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
siyuan-note/siyuan#20353 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
black-forest-labs/skills#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Albert-Weasker/niubigeo#168 ·
Maintainers usually reply within 1 day