← All Components
<mth-tree-item>
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
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>import '@methane-ui/ui/tree-item';
import '@methane-ui/react';
export function Example() {
return <mth-tree-item>Example</mth-tree-item>;
}<script setup lang="ts">
import '@methane-ui/ui/tree-item';
</script>
<template>
<mth-tree-item>Example</mth-tree-item>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/tree-item';
import { MthTreeItemDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthTreeItemDirective],
template: `<mth-tree-item>Example</mth-tree-item>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/tree-item';
import MthTreeItem from '@methane-ui/svelte/MthTreeItem.svelte';
</script>
<MthTreeItem>Example</MthTreeItem>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
value | value | string | "" | Unique node value identifier. |
label | label | string | "" | Node display text when label slot is not provided. |
expanded | expanded | boolean | false | Whether child <mth-tree-item> nodes are expanded and visible. |
selected | selected | boolean | false | Marks the node as selected. |
disabled | disabled | boolean | false | Disables selection and roving focus. |
lazy | lazy | boolean | false | Marks the leaf as expandable for asynchronous lazy child loading. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-toggle | { value: string; expanded: boolean } | Emitted when the branch disclosure toggle is clicked. |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="host" with host role="treeitem". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| states | Exposes ElementInternals CustomStateSet flags: :state(expanded), :state(selected), :state(disabled), :state(branch). | Conformance suite |
| i18n | Routes 2 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |