Vibary.ai
← Vibe Coding

Back to Top Appear

A return control lifts into the corner once the reader is deep enough for it to matter.

navigationsubtlefriendlyautomatic · finite · starter · ~0.3s
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

312 lines · react + motion only
import { useEffect, useRef, useState, type UIEvent } from "react";
import { animate, AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Back to Top Appear
 *
 * The return control stays out of the way until the reader is deep
 * enough for it to be worth something, then lifts into the corner.

About this pattern

The smallest useful piece of navigation on a long page, and the one most often done badly. The control is absent — not faded, not disabled — until the scroll passes a threshold that means the reader has genuinely travelled, then it lifts into the corner on a hard-damped spring and stops. It leaves faster than it arrives, because a control that lingers on the way out reads as reluctant. The corner of the eye is the hardest place in an interface to put movement, so there is exactly one settle here and no bounce at all; the press itself gets a small compression instead, which is felt rather than watched. The journey home is an eased glide with a long tail, so the reader can still recognise what went by.

Long activity feedArticle footer returnSearch results pageDocumentation sidebar

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • Ridgeline
    Docs
    Recent
    Shared
    Templates
    Trash
    DocsNew
    Q3 planning notesEdited 14 minutes agoScope
    Document page

    A corner control that only appears once a thread has been scrolled a fair way.

Related patterns