# Framer Motion

### Credits

All the base examples of the animations and overall how this work you can find on their official documentation [here](https://www.framer.com/motion/).

In this block we just briefly take a look how this animation set in our project.

### Requirement

First of all we need to install package:&#x20;

```json
"framer-motion": "^11.3.2",
```

### Example

In file we import:

```javascript
import { AnimatePresence, motion } from 'framer-motion';
```

{% hint style="warning" %}
N.B. AnimatePresence not always necessary.
{% endhint %}

Base usage on example in Lead Statuses Settings:

```javascript
<motion.div key="edit" {...statusesForm} className="tour-statuses-list">
        <DndContext sensors={sensors} collisionDetection={closestCorners} onDragEnd={handleDragEnd}>
                <StatusesList statuses={statuses} />
        </DndContext>
</motion.div>
```

or more complicated example just lower in the code:

```javascript
<AnimatePresence mode="wait">
                {mode === 'edit' && (
                    <motion.div key="edit" {...statusesForm}>
                        <EditStatus
                            t={t}
                            statuses={statuses}
                            colors={colors}
                            handleUpdateStatus={handleUpdateStatus}
                            handleOpenDeleteModal={handleOpenDeleteModal}
                            loading={loading}
                        />
                    </motion.div>
                )}
                {mode === 'add' && (
                    <motion.div key="add" {...statusesForm}>
                        <AddStatus t={t} colors={colors} handleCreateStatus={handleCreateStatus} loading={loading} />
                    </motion.div>
                )}
</AnimatePresence>
```

From this example we can understand that render switches on display based on different conditions. Animation make experience of UI usage more smooth.

### Helpers

You may notice this thing in component code:

```javascript
{...statusesForm}
```

Such code you can find in ***.../ui/src/common/animationVariants/***

As you can see, in that folder we stores other animation variants.

Just go there and try it!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://intercode.gitbook.io/intercode-saas-kit/animation-and-styles/framer-motion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
