Component

Back to top link

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

Search for usage of this component on GitHub.

How it looks (preview) (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
  • have meaningful 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"
} %>