Components
← All components

Scroll Visibility

stimeo--scroll-visibility

Shows or hides an element based on scroll amount or direction (back-to-top, hide-on-scroll).

The stimeo--scroll-visibility controller has no dedicated APG pattern; when the element is a button it follows the Button practice. In offset mode the element is shown once the scroll source is scrolled past offset px; in direction mode it is hidden while scrolling down and shown while scrolling up. The window is observed by default, but in a fixed-shell layout where the page itself does not scroll, point root at a container selector to observe that container's scroll (and toTop then returns that container to the top). Visibility is reflected through the hidden attribute (so a hidden control also leaves the focus order) and data-state. The scroll listener is passive and coalesced through requestAnimationFrame, and removed on disconnect (Turbo included). toTop honors prefers-reduced-motion with an instant jump and can move focus to a focusSelector target. Behavior only — the look and transition are owned by this Playground.

running

Scroll inside this box — a “Back to top” button appears at the bottom-right.

Content line 1

Content line 2

Content line 3

Content line 4

Content line 5

Content line 6

Content line 7

Content line 8

Content line 9

Content line 10

Content line 11

Content line 12

Keyboard

KeyAction
Enter / Space Activate the back-to-top button (standard button behavior).