Kaupvik KeelKaupvik Keel
Open Source · v0.6.4

Relationship graph

Explore real companies, purchasing locations and shared buyers.

Interactive example

Loading Polaris web components…

Usage

import {RelationshipGraph} from '@kaupvik/polaris/graph';
import '@xyflow/react/dist/style.css';
<RelationshipGraph nodes={nodes} edges={edges} onSelect={setSelected} onReorder={orderSiblings} />

Properties

PropertyTypeDefaultDescription
nodesNode[]RequiredNative GIDs, node data, parentId and the host position.
edgesEdge[]RequiredVerified native relationship and role labels.
onSelect(id)=>void—Inspect a record in the host.
labelstringCompany relationshipsAccessible graph name.
onMoveRequest(buyerId,locationId)=>void—Optional drop intent; host previews and authorizes.
onReorder(id,targetId)=>void—Sibling dragged next to a target; host saves the order.
focusIdstring—Centre this card when it changes, e.g. a new record.
toolsCanvasTool[][]Extra toolbar controls, such as expand/collapse per level.
initialLayout{viewport}—Saved camera only; card coordinates are never persisted.
onLayoutChange(layout)=>void—Host debounces revisioned camera persistence.

Design & interaction

The host owns the tidy layout and passes one computed position per card, so the canvas stores no coordinates and always renders an even, layered map. Dragging a card returns it to that position and only emits a sibling reorder; there is no pixel-level nudge. Canvas tools carry pressed state for level filters and expand/collapse-all actions. Collapse never fits or recenters the viewport. Hand/select tools support Shift multi-selection. Native relationship drops emit reviewed intent only. Empty app draft profiles can appear before assigning native companies.

Accessibility

React Flow keyboard navigation and controls; always provide a tree/list alternative and a native-record inspector. Toolbar buttons expose aria-pressed for active filters, and every icon shares one centred line with its label. Respect reduced motion; do not animate relationship edges.

Open-source source

Available in github.com/Kaupvik/kaupvik-polaris ↗. Host apps supply authentication, native persistence, and read-back state.