Vibary.ai
← Vibe Coding

Banner Dismiss

An announcement strip fades its message, then collapses its own height so the page closes the gap.

feedbackminimalcalminteraction · finite · intermediate · ~0.4s
Interactive · click to play
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.

214 lines · react + motion only
import { useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Banner Dismiss
 *
 * An announcement banner that leaves in two beats: the message fades
 * and lifts, then the strip collapses its own height so whatever sits

About this pattern

Dismissing a banner is a layout event as much as a visual one: something goes away and everything under it has to move. The exit runs in two beats — the message fades and lifts a few pixels, then the strip closes its height on a short ease so the content below rises into the space rather than snapping upward. The order matters, because collapsing a strip while its sentence is still legible squashes the sentence. The spacing under the banner lives inside the collapsing element, so the gap closes with it and the page is not left with a hole. Nothing springs: an overshooting collapse would drag the page past its resting line and back.

Product announcement stripTrial expiry noticePolicy or consent noticeRelease note bar

Where it shows up

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

  • OverviewLast 30 days
    Revenue$48,210+12.4%
    Orders1,284+3.1%
    Refunds$1,940−0.8%
    Revenue by day
    Dashboard

    Dismissible notices collapse out of the flow rather than blinking away.

Related patterns