jbmui

Pop

  • Motion
  • replayable
  • video player

Spring entrances for Remotion: Pop slides or scales one block in, Stagger cascades a list, and Leave fades a block out.

Loading preview…

Install

npx shadcn@latest add @jbm/pop

Needs the @jbm entry in components.json; see Install once.

Also installs @jbm/motion-hooks.

Needs Remotion: render inside a Remotion <Composition> or <Player>, not a plain React tree. Timing values are in seconds.

Usage

Cascade chips
import { Stagger } from "@/jbm/motion/pop"import { Chip } from "@/jbm/ui/chip" // install @jbm/chip separately<Stagger at={0.2} step={0.35}>  {["Idea", "Datos"].map(text => <Chip key={text}>{text}</Chip>)}</Stagger>
Enter, then leave before the scene ends
import { Pop, Leave } from "@/jbm/motion/pop"<Leave at={3}>  <Pop at={0.4} from="left" dist={60}>    <h2>Primero esto.</h2>  </Pop></Leave>// Render inside a Remotion <Composition> or <Player>.

API

Stage
fluid

Each wrapper is a plain block div sized by its children; Pop, Stagger, and Leave add no box of their own. Translations and scale do not change layout size, so reserve room for dist travel near the safe-area edge.

Popcomponent

Wraps children in a div whose opacity follows a useIn spring from at, while it translates in from one side by dist or scales from 0.6 to 1.

PropTypeDefaultDescription
atnumberrequiredEntrance start in seconds relative to the enclosing Sequence.
childrenReact.ReactNoderequiredContent to reveal.
styleReact.CSSPropertiesnoneInline styles merged onto the wrapper (after opacity and transform, so a transform here replaces the motion).
from"up" | "down" | "left" | "right" | "scale""up"Entrance direction: up rises from below, down drops from above, left/right slide in from that side, scale grows from 0.6×.
distnumber40Travel distance in stage pixels for the directional entrances; ignored by scale.

Staggercomponent

Wraps each child in a Pop; child i enters at at + i × step seconds.

PropTypeDefaultDescription
atnumberrequiredStart of the first child, in seconds relative to the enclosing Sequence.
stepnumber0.3Seconds between consecutive children.
from"up" | "down" | "left" | "right" | "scale""up"Entrance direction applied to every child (see Pop).
distnumber14Travel distance in stage pixels for every child.
childrenReact.ReactNode[]requiredArray of children to cascade; each becomes its own Pop wrapper.

Leavecomponent

Exit: from at, the wrapper fades out with cubic-out easing and drifts up by dist over 0.4 s, keeping its layout space.

PropTypeDefaultDescription
atnumberrequiredExit start in seconds relative to the enclosing Sequence.
childrenReact.ReactNoderequiredContent that leaves.
styleReact.CSSPropertiesnoneInline styles merged onto the wrapper (after opacity and transform).
distnumber30Upward drift in stage pixels at the end of the exit.

QA checks

  • Step through the first frame (children invisible), mid-cascade (earlier children settled, later ones entering), and the last frame (all fully opaque at rest).
  • Try each from value: directional entrances move by dist and settle at 0 offset; scale grows without translating.
  • Check the spring overshoot does not push content past the safe area, especially with large dist values in vertical.
  • For Leave, confirm the block is fully transparent 0.4 s after at and its layout space remains.