Skip to content

AnimateGrow

Content unfolding from a point. It starts close to its final size and can be anchored to any edge, so it reads as something opening out of the thing next to it.

tsx
import { AnimateGrow } from 'neba';

<AnimateGrow origin="top">
  <Card title="Filters">Three of nine applied.</Card>
</AnimateGrow>;

Props

PropTypeDefaultDescription
fromnumber0.8The scale it starts from, as a multiple of its final size. Above 1 it settles down onto the page
originstring'center'Which point stays put while the rest moves: any CSS transform-origin
fadebooleantrueFades in as it grows
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
durationsharednumber340How 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
renderuseRender.RenderPropRenders something other than a div (render={<li />}). Base UI's own escape hatch
childrenReactNodeWhat unfolds

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

Examples

origin

Any CSS transform-origin: the point that stays put while the rest moves. top unfolds downwards, bottom left out of a corner, and the default center grows evenly in every direction. It is the prop that decides what the growth appears to be coming out of.

from and fade

from is the scale it starts at, as a multiple of its final size. Below 1 it opens out; above 1 it arrives oversized and settles down onto the page. fade is the opacity ramp that comes with it, and turning it off is right for something already on screen that is only changing size.

mode

out folds it away again: the same animation backwards, held at the end.

tsx
<AnimateGrow mode="out" origin="top">
  <Card title="Filters">Three of nine applied.</Card>
</AnimateGrow>

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 entirely and the content is simply there, at full size.
  • Scale is applied with the standalone scale property rather than the transform shorthand, so a transform of your own on the same element survives.

Released under the MIT License