Outline @astryx-svelte/core v0.3.0 · Outline

Usage

A table-of-contents sidebar for documentation pages, help centers, wikis, and long settings pages. Use it for navigation within a single page, not for app routes. Features a sliding indicator track that animates to the active heading. The list is a single tab stop: arrow keys move between headings, Home/End jump to the ends, and Enter/Space activate.
ts
import { Outline } from '@astryx-svelte/core';

Best practices

GuidancePractices
DoPass a flat ordered list of headings and let level control indentation.
DoUse activeId when custom scroll logic owns the active section.
DoUse density="compact" in dense sidebars where vertical space is tight.
DoUse useOutlineFromMarkdown or useOutlineFromDOM when headings are generated from content.
DoPass scrollContainerRef when the content scrolls in a split pane, modal, or panel instead of the viewport.
DoSet offset to the height of a fixed header that overlays the content, so headings land below it instead of underneath it.
Don'tUse Outline for application navigation - use SideNav or TopNav for routes.
Don'tUse Outline for expandable hierarchy - use TreeList when nodes need expand and collapse.
Don'tRely on onNavigateEnd to mean "arrived" - it also fires when the user interrupts the scroll.

Examples

Common configurations, variations, and states.
Outline — Controlled
Drive the active section yourself with activeId and onActiveIdChange. Providing activeId disables the built-in scroll-spy so your own logic owns the highlight.
Outline — Deep Nesting
Heading levels 1 through 4 map to progressively deeper indentation, so a long document with sub-sections stays scannable.
Outline — Density
Two density variants control item padding. Use compact for dense sidebars and default for standard documentation layouts. The sliding indicator automatically matches each item height.