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

<mth-tree-item>

@methane-ui/ui~6.8 KB brotli (cold + Lit)~1.4 KB marginal

Hierarchical treeview node (role="treeitem") supporting nested <mth-tree-item> subtrees, expand/collapse disclosure, and selection states.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/tree-item"></script>
<mth-tree-item>Example</mth-tree-item>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
valuevaluestring""Unique node value identifier.
labellabelstring""Node display text when label slot is not provided.
expandedexpandedbooleanfalseWhether child <mth-tree-item> nodes are expanded and visible.
selectedselectedbooleanfalseMarks the node as selected.
disableddisabledbooleanfalseDisables selection and roving focus.
lazylazybooleanfalseMarks the leaf as expandable for asynchronous lazy child loading.

Events

EventDetail TypeDescription
mth-toggle{ value: string; expanded: boolean }Emitted when the branch disclosure toggle is clicked.

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="host" with host role="treeitem".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
statesExposes ElementInternals CustomStateSet flags: :state(expanded), :state(selected), :state(disabled), :state(branch).Conformance suite
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test