BackToTop <pm-back-to-top>
Back to top: a floating button that appears after the page has been scrolled and returns to the top (instantly when the user prefers reduced motion). Focus moves to the top of the page as well.
Release notes
Scroll this box. The button appears after 120 px and brings you back up.
2.4
Charts, scheduler and the rich-text editor.
2.3
Tree select, cascader and transfer list.
2.2
Menubar, submenus and hover cards.
2.1
Tour, QR code, virtual list and signature pad.
2.0
Five surface styles and the OKLCH colour engine.
1.9
Native phone patterns: sheets, tab bar and swipe actions.
Overview
For a scrolling panel instead of the page, put the element inside the panel and set target to the panel's id: the button then floats in the panel's bottom corner.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
threshold | number | 600 | Pixels scrolled before the button appears (default 600). |
label | string | — | Accessible name (default "Back to top"). |
position | 'end' | 'start' | 'center' | — | Corner: end (default), start or center. |
target | string | — | Id of a scrolling element to watch and scroll instead of the page. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Slots
| Slot | Description |
|---|---|
(default) | Custom icon or text. |