Skip to main content Home
About About the Design SystemRoadmap
Get started OverviewDesignersDevelopers
Foundations OverviewColorGridIconographyInteractionsSpacingTypography
Tokens Overview Global colorbox shadowTypographyborderopacityspacelengthIconBreakpointsMedia Queries
Elements All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Navigation (primary) Navigation (secondary) Pagination PopoverPlanned Progress stepsPlanned Site status Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed
Theming OverviewColor PalettesCustomizingDevelopers
Patterns All PatternsCardTabsFilterFormLink with iconLogo wallSearch barSticky bannerSticky cardTile
Personalization All Personalization PatternsAnnouncement
Accessibility FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers
Design/code status Release notes Get support

Back to top

OverviewStyleGuidelinesCodeAccessibilityDemos
OverviewStatusWhen to useStatus checklistOverviewStatusWhen to useStatus checklist

Overview

Back to top component is a fragment link that allows users to quickly navigate to the top of a lengthy content page.

import '@rhds/elements/rh-back-to-top/rh-back-to-top.js';
#overflow {
  min-block-size: calc(100dvh + 401px);
}

p {
  font-weight: bold;
}
<div id="overflow">
  <p>Scroll down to reveal the back to top element</p>
  <rh-back-to-top href="#">Back to top</rh-back-to-top>
</div>

Flag to always show back to top button, defaults to false.

Element selector to spy on for scrolling. Not passing a selector defaults to spying on window scroll events

Distance from the top of the scrollable element to trigger the visibility of the back to top button

Page fragment link to target element, must include hash ex: #top

Status

When to use

  • When content fills up more than two screens in length at medium and large breakpoints
  • When content fills up more than four screens in length at small breakpoints
Example of a back to top button

Status checklist

Other libraries

To learn more about our other libraries, visit the getting started page.

© 2025 Red Hat Deploys by Netlify