1. Government Frontend Component Guide
  2. Back to top link

Component

Back to top link

An anchor link intended to allow users to return to the top of the content.

How it looks (preview all)

How to call this component

<%= render "components/back-to-top", {
  href: "#contents"
} %>

Accessibility acceptance criteria

Links in the component must:

  • accept focus
  • be focusable with a keyboard
  • be usable with a keyboard
  • indicate when they have focus
  • change in appearance when touched (in the touch-down state)
  • change in appearance when hovered
  • be usable with touch
  • be usable with voice commands
  • have visible text

Other examples

With different text (preview)

<%= render "components/back-to-top", {
  href: "#contents",
  text: "Back to top"
} %>

Right to left (preview)

<%= render "components/back-to-top", {
  href: "#contents"
} %>