GoToPreviousSection
A link that takes users to the previous section of the current page.
Implementation Notes
- Renders an
<a>with classgo-to-previous-sectionlinking to a section anchor on the same page - Accepts a
hrefprop pointing at the previous section's anchor (e.g.#section-2) - Accepts a
labelprop for the visible link text - Companion to
GoToNextSectionandGoToTop
Props
href: string (required) — anchor URL of the previous section, typically#section-idlabel: string (required) — visible link textclassName: string (optional) — extra CSS classes appended togo-to-previous-section
Usage
<GoToPreviousSection href="#section-1" label="Previous section: Introduction" />
Keyboard Interactions
- Tab: moves focus onto the link
- Enter: navigates to the linked anchor (native browser behavior)
ARIA
- Native anchor accessibility — the
hrefprovides the destination, the link text provides the accessible name
When to Use
- On long single-page documents where users benefit from sequential navigation between adjacent sections.
- Together with
GoToNextSectionto give readers symmetric forward/back movement at the end of each section. - When section anchor IDs are stable enough to link to.
When Not to Use
- Do not use to navigate between separate pages — use
BackLinkfor cross-page back navigation. - Do not use as the primary on-page navigation for an article — use
ContentsNavorSectionNavinstead. - Do not use when there is no logical "previous" section (e.g. on the first section of a page).
Headless
This headless component renders semantic HTML. The consumer provides all visual styling. No CSS, animations, or layout are included — the consumer composes those.
Styles
The component renders with .go-to-previous-section as the root class. No default styles are included.
Related components
go-to-next-section— a link that takes users to the next section of the current pagego-to-top— a link that returns users to the top of a long pagesection-nav— a navigation container for section navigation links
References
- Documentation: index.md
- CSS class:
.go-to-previous-sectionin css-style-sheet-template.css