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

<mth-org-chart>

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

Accessible hierarchical org-chart wrapping @dagrejs/dagre with subtree collapse/expand and member search.

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-org-chart> (@methane-ui/flow)
Ready · interact with <mth-org-chart>, or toggle Theme, Direction (LTR/RTL), or props above.

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/flow/org-chart"></script>
<mth-org-chart direction="TB"></mth-org-chart>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
nodes—ReadonlyArray<unknown>—Organization hierarchy nodes with parentId links or nested children.
directiondirection'TB' | 'LR' | 'RL' | 'auto'"TB"Chart layout direction (TB, LR, RL, or auto).
queryquerystring""Case-insensitive search filter across member names, titles, and departments.
selectedIdselected-idstring""Currently focused or selected member ID.
collapsedIds—ReadonlyArray<string>—IDs of collapsed manager nodes.
labellabelstring""Accessible region label.

Events

EventDetail TypeDescription
mth-node-select{ nodeId: string }Fired when a member card is selected.
mth-node-toggle{ nodeId: string; collapsed: boolean }Fired when a branch node is expanded or collapsed.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
ArrowRightltrFocus is on a member cardMoves focus to the next visible member card
ArrowLeftltrFocus is on a member card after the first cardMoves focus to the previous visible member card
EnterbothFocus is on a member cardSelects the member card 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-org-chart.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(empty).Conformance suite
i18nRoutes 7 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test