Animate Presence API

Detailed listing of all animate presence related features of Svelte Motion. A lot of the wording is directly copied from framer-motion, Copyright (c) 2018 Framer B.V. MIT License.


<T extends {key: any}> SvelteComponent<Props: AnimatePresenceProps <T>, Events: {}, Slots: {default: {item: T | {key: 1}}>
`AnimatePresence` enables the animation of components that have been removed from the tree.

You can provide an array T[] to the `list` prop, where each item has to have a unique `key` attribute. Via slot prop `item` single items of the array are passed down to children, so that for each array item one component is rendered.

Alternatively you can leave `list` undefined and supply a boolean to the `show` prop. If `true`, the child is rendered.

You can sequence exit animations throughout a tree using variants.

If a child contains multiple Motion components with `exit` props, it will only unmount the child
once all Motion components have finished animating out. Likewise, any components using
usePresence all need to call `safeToRemove`.


interface <T extends {key: any}>


enum {
Entering = 0,
Present = 1,
Exiting = 2


() => Readable<boolean>
Similar to usePresence , except `useIsPresent` simply returns whether or not the component is present. There is no `safeToRemove` function.


() => Readable< AlwaysPresent | Present | NotPresent >
When a component is the child of AnimatePresence , it can use `usePresence` to access information about whether it's still present.