VisorVisor
ComponentsForm

Scroll Hint

A "More Below" pill pinned to a scroll box's bottom edge while there is more to scroll, with a Keep Going hook that jumps to the next unanswered field.

Default

A long form in a fixed-height box. The pill shows while there is more to scroll and hides at the end. The button reads Keep Going while an empty field sits below the fold, and jumps to it. Tapping the pill does the same, or pages the box down when every field below is filled.

Installation

npx visor add scroll-hint

This copies scroll-hint.tsx (the component and the useKeepGoing hook) and scroll-hint.module.css into your project.

Usage

  • Render ScrollHint as the scroll box's last child. It is a zero-height sticky row, so it pins to the box's bottom edge and takes no room.
  • Mark each field with data-field="<id>" (or pass another attribute as useKeepGoing's third argument), and pass the ids still to fill or fix, in order, as pending.
  • When the box lays its children out with a row gap, set --scroll-hint-gap to that gap. The hint row's negative top margin undoes it, so the hint adds no space. FormDeck's slide uses 40px and the edit sheet 20px.
  • The pill is an overlay, not a fade. A mask on the scroll box would make it a backdrop root, and glass fields inside would stop blurring the photo behind them.

useKeepGoing

const keepGoing = useKeepGoing(boxRef, pending, attr = 'data-field', watch?)
// → { more, below, go }
ReturnsMeaning
moreThere is more to read below the box's bottom edge. ScrollHint shows while it is true.
belowA pending field sits below the fold, so the main button can read "Keep Going".
go()Scrolls the next pending field below the fold to a fifth of the way down the box and focuses its first control. Returns false when there is none.

go() focuses only on a fine pointer (mouse and keyboard). On touch it scrolls without focusing, because focusing a field throws up the keyboard. Under prefers-reduced-motion: reduce it jumps instead of smoothing. Pass watch when the box mounts later or swaps its fields (a dialog), so the hook re-attaches.

API Reference

PropTypeDefaultDescription
boxRef*RefObject<HTMLElement | null>—The scroll box the hint sits in. Render the hint as its last child.
keepGoing*KeepGoing—What useKeepGoing returns for the same box. `more` shows the pill; a click calls `go()`, or pages the box down by 0.8 of its height.
labelReactNode"More Below"The pill's words.

Theming

TokenBindsFalls back to
--scroll-hint-bgThe chip's fill, glass off.var(--surface-card)
--scroll-hint-borderThe chip's edge, glass off (an inset ring).var(--border-default)
--scroll-hint-colorThe pill's words and caret.var(--text-secondary)
--scroll-hint-glass-bgThe pill's fill over a photo.color-mix(in srgb, var(--surface-page) 70%, transparent)
--scroll-hint-gapThe scroll box's row gap, which the hint undoes.0px

The pill shows and hides in CSS: opacity and a 6px rise over --motion-duration-500 on --motion-easing-enter, and no transition under reduced motion. Visor gains no animation dependency.

Glass

Glass is off by default. In plain looks the pill is a solid chip: the card fill, a hairline ring and no backdrop-filter. Inside data-glass="on" (see Glass) it turns to the page colour at 70%, blurred with the glass layer's control blur, with no ring.

In Five Looks

ScrollHint on a long form in each look, on the theme picked in the docs. The Photo looks turn glass on over a photo, with the form on a glass form panel.

Today
Dark
Dark + Photo
Light
Light + Photo

Honcho Backstage

The Honcho kit's "More Below" pill from the theme alone: a solid chip in Today (the honcho theme), Dark and Light, and the paper colour at 70% with the glass blur in Dark + Photo and Light + Photo, where the form sits on a glass form panel.

Today
Dark
Dark + Photo
Light
Light + Photo

Accessibility

  • The pill is aria-hidden and out of the tab order (tabIndex={-1}). Keyboard and screen-reader users reach the next field through the form's own Keep Going button, which calls the same go()
  • go() moves focus to the field's first control on a fine pointer, so a keyboard user lands in the field
  • Under prefers-reduced-motion: reduce the pill appears without a transition and go() jumps without smoothing