Skip to content

Search Feitio

↵ opens the first↑↓ chooseEsc closes

Anchor

The page index, which follows the scroll and marks the section the person is in.

On this page

Playground

Current part
Background
HTML
<nav class="feitio-anchor" aria-label="Index example"><p class="title">On this page</p><ul><li><a href="#playground" aria-current="location"><svg class="feitio-icon" aria-hidden="true"><use href="/feitio/icons/sprite.svg#feitio-chevron-right"></use></svg>When to use</a></li><li><a href="#playground"><svg class="feitio-icon" aria-hidden="true"><use href="/feitio/icons/sprite.svg#feitio-chevron-right"></use></svg>Examples</a></li><li><a href="#playground"><svg class="feitio-icon" aria-hidden="true"><use href="/feitio/icons/sprite.svg#feitio-chevron-right"></use></svg>Accessibility</a></li></ul></nav>

When to use

When not to use

Examples

The index

The page’s headings (h2, and h3 under them). The current section is in ink and bold, with the hand-drawn arrow in front. This page has its own, on the right on wide screens.

Show code
HTML
<nav class="feitio-anchor" aria-label="Nesta página">
  <p class="title">Nesta página</p>
  <ul>
    <li><a href="#quando">…Quando usar</a></li>
    <li><a href="#exemplos" aria-current="location">…Exemplos</a>
      <ul><li><a href="#ex-mobile">…No mobile</a></li></ul>
    </li>
  </ul>
</nav>
On this page

On mobile

The same index goes in a closed "On this page" Details at the top of the content. Tapping a section scrolls to it and closes the list.

Show code
HTML
<details class="toc-mobile">
  <summary>…Nesta página</summary>
  <nav class="feitio-anchor">…</nav>
</details>

Anatomy

  1. Title: "On this page".
  2. Section: a link per h2, in soft ink.
  3. Current section: ink, bold and the hand-drawn arrow. No side stripe.
  4. Subsection: the h3s, one step in.

States

Do and don’t

Do

The current section with ink, bold and the arrow.

Don’t

The orange side stripe: the mark of every generic doc site.

Accessibility

Attributes

AttributeValuesWhat for
class="feitio-anchor"on the <nav>The list of sections, with the current one marked.
aria-current="location"on the current sectionInk, bold and the arrow; set by the script.
idon each h2 and h3Without an id, the heading stays out of the index.
Top