AnimatePresence
Keeps a child mounted while its native exit animation runs.
Keeps one native child alive while its exit targets are animated by the Rust renderer. Keep the boundary itself mounted and toggle `present` so Tarve can retain native identity.
Import
import { AnimatePresence } from "@tarve/core";Usage
import { Alert, AnimatePresence } from "@tarve/core";
let visible = true;
<AnimatePresence
id="saved-banner"
present={visible}
enter={{ opacity: 0 }}
exit={{ opacity: 0, height: 0 }}
transition={{ all: { duration: 240, easing: "easeOut" } }}
>
<Alert variant="success" title="Saved" description="Your changes are live." />
</AnimatePresence>Props
| Prop | Type | Default |
|---|---|---|
children required | VNode | — |
exit required Numeric targets held until their native transitions finish. | MotionValues | — |
id required Stable identity for this presence boundary. | string | — |
present required | boolean | — |
enter Initial numeric values applied when the native node is first mounted. | MotionValues | — |
transition Overrides the child's style.transition for enter/exit motion. | MotionTransitions | — |
Types
type MotionTransitions = Partial<Record<MotionProperty | "all", MotionTransition>>;type MotionValues = Partial<Record<NumericMotionProperty, number>>;