Skip to content

Toc

An “On this page” table of contents. It lists anchors to the content’s headings and highlights the visible section (scrollspy). It renders as a <nav> with aria-current on the active item.

Navigation · TaishoDS Core, in plain HTML.

Examples

One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.

Project table of contents

Overview

Dashboard: overall project status.

Deployments

The last three went to Production without failures.

Team

Ana Torres, Bruno Díaz, and Carla Ruiz work on this project.

html

When to use

  • The page is long and people skip between sections.
  • The headings are descriptive enough to work as a map.
  • It helps to know where you are in the document.

When not to use

  • The page is short. The table of contents takes up more than it saves.
  • It’s navigation between pages, not within one → sidebar or nav-bar.
  • They’re alternate views of the same block → tabs.

Do

  • Index a single heading level, or two at most.
  • Adjust data-ts-offset if you have a fixed bar at the top, so the anchor isn’t hidden under it.

Don’t

  • Don’t list every subheading. A table of contents longer than the section isn’t a table of contents.
  • Don’t use it for links that leave the page.

TaishoDS Core

Needs Core’s JS, which hooks in through data-ts-* attributes.

Highlights the section you’re reading as you scroll, and Core handles that.

Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.

  • data-ts-offset
  • data-ts-scrollspy
  • data-ts-scrollspy-link

What it does: Listens to scroll and resize, and marks the active heading with aria-current="location". At the bottom of the page, it marks the last one.

From the CDN, without a build, load taisho.toc.css along with taisho.base.css. That file is all you need.

For how Core works in general, see Behavior.

Accessibility

  • It’s a <nav aria-label>. The item for the visible section carries aria-current="location".

Verification

What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.

  • axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
  • keyboard Adds no keys of its own—it uses the browser’s native behavior.
  • screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.