Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-flow-editor>

@methane-ui/flow~7.9 KB brotli shell + lazy engine~2.0 KB shell · lazy engine chunk

Accessible node/DAG flow editor wrapping @dagrejs/dagre with pan/zoom plane and keyboard node traversal.

When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.

Live Interactive Preview

Interactive StageLive Custom Element · <mth-flow-editor> (@methane-ui/flow)
Ready · interact with <mth-flow-editor>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/flow/flow-editor"></script>
<mth-flow-editor direction="TB" edge-style="bezier"></mth-flow-editor>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
nodes—ReadonlyArray<unknown>—Flow node definitions.
edges—ReadonlyArray<unknown>—Directed edges connecting source and target node IDs.
directiondirection'TB' | 'LR' | 'RL' | 'BT' | 'auto'"auto"DAG layout rank direction (auto resolves LR/RL from document direction).
edgeStyleedge-style'bezier' | 'orthogonal'"bezier"Connector routing geometry (bezier or orthogonal).
zoomzoomnumber1Viewport scale factor.
panXpan-xnumber0Horizontal pan offset in pixels.
panYpan-ynumber0Vertical pan offset in pixels.
selectedIdselected-idstring""Currently selected node ID.
autoLayoutauto-layoutbooleantrueRuns Dagre DAG auto-layout automatically when nodes/edges update.
labellabelstring""Accessible region label.

Events

EventDetail TypeDescription
mth-node-select{ nodeId: string }Fired when a flow node is selected.
mth-viewport-change{ zoom: number; panX: number; panY: number }Fired when pan or zoom changes.
mth-layout-complete{ nodeCount: number; edgeCount: number }Fired after Dagre layout computes coordinates.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrFocus is on a node inside the flow editorMoves focus to the next node
ArrowLeftltrFocus is on a node after the first nodeMoves focus to the previous node
EnterbothFocus is on a nodeSelects the node and emits mth-node-select

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 3 APG keyboard transitions across LTR/RTL.mth-flow-editor.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(empty).Conformance suite
i18nRoutes 9 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test