Document Outline
ProA live table of contents for one rich text editor — headings down to a level, the current one marked, a click scrolls there; no ids are written into the document.
</>sv-rte-outline editortocoutlinenavigation
import { SvRteOutlineComponent } from '@styloviz-pro/rich-editor';Demo & usage
Basic usage
Usage example — open the gallery for the full interactive demo.
Pro
An interactive demo for this component lives in the gallery.
Open live demoMore examples
Beside the editor
The outline follows every edit; `headingSelect` reports the heading chosen.
When to use
Documents long enough to scroll: handbooks, specs, policies. A short note with one heading does not need one.
Async states
None — this component has nothing to load, so it has no loading, empty or error state to drive.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| editorrequired | SvRichTextEditorComponent | — | The editor whose headings to list. |
| maxLevel | number | 3 | Deepest heading level shown (1–6). |
| ariaLabel | string | '' | Accessible name of the outline's `<nav>`. Defaults to the "Document outline" label. |
Outputs
| Event | Payload type | Description |
|---|---|---|
| headingSelect | SvRteOutlineItem | Emitted when a heading is chosen. |
Customization & theming
`maxLevel` (1–6, default 3) and `ariaLabel` for the `<nav>`.
Forms integration
sv-rte-outline— Output-driven, not a ControlValueAccessor. It navigates a document and has no value of its own — it reports the heading chosen through `headingSelect`.
Best practices
Do: Use real heading levels in order (h1 → h2 → h3); the outline indents by level. Tip: `svRteOutline(element, maxLevel)` returns the same list for a printed TOC or a sidebar of your own.
Accessibility
A labelled `<nav>` of buttons; the heading the caret is under carries `aria-current="location"`. Choosing a heading moves the caret there and focuses the editor, so keyboard users continue typing at the heading.
Feedback on Document Outline
Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.