Available · v0.6.4

Relationship graph

Explore real companies, purchasing locations and shared buyers.

Interactive example

Loading Polaris 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 and 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.

Implementation and ownership

Source: Kaupvik Website, packages/polaris. React client component; controlled host data. No API credentials or merchant transport are included. Host applications own authentication, validation, localization, errors and persisted preferences. Graph nodes use native Shopify identities; diagram positions are presentation only.

Tokens and states

Native controls use Shopify attributes and inherit the host’s design system. Kaupvik layout tokens: --kp-surface, --kp-surface-subdued, --kp-ink, --kp-ink-subdued, --kp-border, --kp-accent, --kp-focus, --kp-radius, --kp-space. Override only within the product surface. Loading, error and empty states are distinct; host data is never invented to fill a preview.

Verification

Test keyboard and pointer operation, focus visibility, 375px and desktop layouts, reduced motion and server hydration. Test every product adapter independently before release. QO remains on its reviewed implementation until its own adoption release.

Related product patterns