Table of Contents

Method AnimatePresence

Namespace
Velvet
Assembly
Velvet.Docs.dll

AnimatePresence(VNode?[]?, string?, bool, float, float, int, AnimatePresenceMode, Action?)

Container that supports mount / unmount animations. When a keyed child becomes null, removal is deferred until the exit animation completes.

public static AnimatePresenceNode AnimatePresence(VNode?[]? children = null, string? key = null, bool initial = true, float staggerSec = 0, float delayChildrenSec = 0, int staggerDirection = 1, AnimatePresenceMode mode = AnimatePresenceMode.Sync, Action? onExitComplete = null)

Parameters

children VNode[]

Child VNodes whose enter / exit transitions are tracked.

key string

Key used to disambiguate siblings at the same position.

initial bool

When false, suppresses enter animations on the very first mount.

staggerSec float

Delay (seconds) staggered between sequential children.

delayChildrenSec float
staggerDirection int
mode AnimatePresenceMode

Exit / enter sequencing. Sync (default) overlaps exit and enter; Wait holds a brand-new child back until in-flight exits finish (suited to single-child route / screen swaps); PopLayout pulls an exiting child out of layout flow so still-present siblings reflow immediately.

onExitComplete Action

Invoked once when every in-flight exit animation has finished; not fired for cancelled exits or animation-less removals.

Returns

AnimatePresenceNode

The created AnimatePresenceNode.

Remarks

AnimatePresence emits no element of its own — its keyed children expand directly into the parent. Put flex / wrap / gap on the parent element. Equivalent to Framer Motion's AnimatePresence (with mode="wait" and onExitComplete) for users migrating from Framer Motion.