← All Components
<mth-org-chart>
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
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>import '@methane-ui/flow/org-chart';
import '@methane-ui/react';
export function Example() {
return <mth-org-chart direction="TB"></mth-org-chart>;
}<script setup lang="ts">
import '@methane-ui/flow/org-chart';
</script>
<template>
<mth-org-chart direction="TB"></mth-org-chart>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/flow/org-chart';
import { MthOrgChartDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthOrgChartDirective],
template: `<mth-org-chart direction="TB"></mth-org-chart>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/flow/org-chart';
import MthOrgChart from '@methane-ui/svelte/MthOrgChart.svelte';
</script>
<MthOrgChart direction="TB"></MthOrgChart>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
nodes | — | ReadonlyArray<unknown> | — | Organization hierarchy nodes with parentId links or nested children. |
direction | direction | 'TB' | 'LR' | 'RL' | 'auto' | "TB" | Chart layout direction (TB, LR, RL, or auto). |
query | query | string | "" | Case-insensitive search filter across member names, titles, and departments. |
selectedId | selected-id | string | "" | Currently focused or selected member ID. |
collapsedIds | — | ReadonlyArray<string> | — | IDs of collapsed manager nodes. |
label | label | string | "" | Accessible region label. |
Events
| Event | Detail Type | Description |
|---|---|---|
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
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowRight | ltr | Focus is on a member card | Moves focus to the next visible member card |
| ArrowLeft | ltr | Focus is on a member card after the first card | Moves focus to the previous visible member card |
| Enter | both | Focus is on a member card | Selects the member card and emits mth-node-select |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 3 APG keyboard transitions across LTR/RTL. | mth-org-chart.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(empty). | Conformance suite |
| i18n | Routes 7 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |