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

<mth-toc>

@methane-ui/ui~7.9 KB brotli (cold + Lit)~2.0 KB marginal

Table of contents navigation landmark that tracks active visible headings using ObserverPoolController.observeIntersection.

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

Multi-Framework Playground & Snippets

<script type="module" src="@methane-ui/ui/toc"></script>
<mth-toc></mth-toc>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
labellabelstring""Accessible label for the <nav> landmark.
headingheadingstring""Visible section title above the list.
activeIdactive-idstring""ID of the currently active heading highlighted with aria-current="location".
targetSelectortarget-selectorstring""Optional CSS selector to auto-discover headings with id attributes from the document.
items—ReadonlyArray<unknown>[]Structured heading items when provided explicitly instead of targetSelector.

Events

EventDetail TypeDescription
mth-select{ id: string; label: string; href: string }Fired when a TOC link is activated.
mth-active-change{ id: string }Fired when intersection tracking or selection changes the active heading.

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
i18nRoutes 2 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test