Skip to content
IzzyBlazor 0.1.0-alpha.17

Enter all results ↑ ↓ move Esc close

OnThisPage

The page's sections, listed on the server.

"On this page": links to the page's sections, for an AppAside.

Usage

razor
<AppAside>
    <OnThisPage />
</AppAside>

Details

Each Heading in AppMain adds itself to the shell's outline while the page renders, so the list is in the first response and works with JavaScript off; the headings get ids from their text. With script, <ib-on-this-page> marks the section in view (aria-current="location") and adds headings the server didn't see: ones in raw HTML (Prose, rendered Markdown) that have ids. With no headings it renders hidden, so the script can still fill it in.

Mode support

What works in each mode, OnThisPage
FeatureOffStaticLive
EverythingPartlyYesYes

Off: JavaScript disabled. Static: a static SSR page with IzzyBlazor's script. Live: an interactive page (Server, WebAssembly or Auto). With JavaScript off, the section in view isn't highlighted, and headings in raw HTML aren't listed.

Accessibility

  • It renders a nav named by its heading, an h2 reading "On this page" (Title).
  • Links to Heading components are in the server's response, so they work with JavaScript off; headings inside raw HTML, such as Prose, are added by the script.
  • With script, the link to the section in view has aria-current="location".
  • With no headings to list it's hidden, so there's no empty landmark.

Parameters

OnThisPage parameters
PropTypeDefault
TitleThe list's heading.string?"On this page"
MinLevelThe highest heading level listed (h2 by default), 1 to 6.int2
MaxLevelThe lowest heading level listed (h3 by default), 1 to 6.int3

See also

  • Heading: headings 1 to 6, with fluid sizes and section links.
  • PrevNext: links to the pages before and after.
  • NavMenu: a list of links that marks the current page.