Skip to content

AnimateReveal

Content uncovered by an edge travelling across it. Nothing moves and nothing changes colour: the content is already in place at full size, and what changes is how much of it has been let through.

tsx
import { AnimateReveal } from 'neba';

<AnimateReveal>
  <h2>Nothing moved. It was let through.</h2>
</AnimateReveal>;

Props

PropTypeDefaultDescription
staggersharednumber0How long after one child the next one starts, in milliseconds. 0 animates the box itself; anything above it moves the effect onto each child in turn
durationStepsharednumber0How much longer each successive child takes, in milliseconds. Negative speeds them up down the list, and never past zero
reversesharedbooleanfalseRuns the children from the last to the first. Only the order reverses
modeshared'in' | 'out''in'Whether the content arrives or leaves. out is the same animation run backwards, and it is held there
durationsharednumber620How long one run takes, in milliseconds
delaysharednumber0How long before it starts, in milliseconds
easingstringThe easing curve, as CSS writes it. Defaults to the house curve
repeatsharednumber | 'infinite'1How many times it runs
alternatesharedbooleanfalseRuns every other pass backwards, so a repeat returns instead of jumping
triggershared'mount' | 'visible' | 'hover' | 'manual''mount'What starts it. visible is on scrolling into view, hover is under the pointer (focus counts), manual is whatever play says
playbooleanRuns it when trigger is manual. Each false → true starts it over
oncesharedbooleantrueWith trigger="visible", whether it runs only the first time. Off, it runs again on every return
thresholdsharednumber0.2With trigger="visible", how much of the element has to be on screen, from 0 to 1
pausedsharedbooleanfalseHolds the animation where it is
side'top' | 'right' | 'bottom' | 'left''left'The edge the wipe travels from. left uncovers left to right
fromnumber1The opacity it fades from as it wipes. 1 is a wipe and nothing else
renderuseRender.RenderPropRenders something other than a div (render={<h2 />}). Base UI's own escape hatch
childrenReactNodeWhat is uncovered

Every other <div> attribute passes through to the root. The settings shared by every Animate* are defined in prop conventions.

It is a clip-path, so there is no wrapper and no overflow box: the element takes exactly the room it always took, and everything around it is laid out against the finished size from the first frame. That makes it the effect for a heading, a rule or a chart's plot area: anything whose position is part of the information.

Examples

side

The edge the wipe travels from. left (the default) uncovers left to right.

from

Fades as it wipes, from this opacity. 1 (the default) is a wipe and nothing else, which is usually the point of reaching for one. Set it to 0 for both at once.

mode

mode="out" runs the same edge backwards and holds it there, which covers the content up again.

stagger

stagger, durationStep and reverse hand the effect to the children one at a time instead of running it on the box. They work the same way here as on AnimateFade, where they are set out in full.

Accessibility

  • A reduced-motion preference switches the animation off and the content is drawn whole, which is what it was always going to be.
  • The content is in the document and in the accessibility tree the entire time. A clip hides pixels, not information.

Released under the MIT License