Course contentsShow
← React
Lesson 1969 of 2,39645. AnimationsFree lesson

The initial Prop: Setting Starting States

Control the element's starting state before animation with the initial prop.

The initial Prop: Setting Starting States

What you'll learn: How to control where an animation begins by defining the element's starting appearance with Framer Motion's initial prop.


When you animate an element with animate, Framer Motion needs to know two things: where the animation starts and where it ends. The animate prop tells it the destination, but what about the beginning?

By default, Framer Motion uses the element's current CSS values as the starting point. But often you want explicit control—maybe you want something to fade in from invisible, or slide in from off-screen. That's where initial comes in.

How It Works

The initial prop accepts the same object format as animate, defining the element's state before the animation runs:

<motion.div
  initial={{ opacity: 0, y: 20 }}
  animate={{ opacity: 1, y: 0 }}
>
  Fades in and slides up
</motion.div>

When this component mounts, it starts at opacity: 0 and y: 20 (20 pixels down), then animates to opacity: 1 and y: 0.

Think of It Like a Photograph

Imagine initial as setting up your camera shot's starting frame, and animate as the final frame. Framer Motion smoothly fills in all the frames between those two states.

Without initial

If you omit initial, the element starts at whatever its natural CSS state is. For a fade-in effect, this means it would already be visible—no fade at all.


Key Takeaway: The initial prop defines where your animation begins, giving you full control over entrance effects by setting explicit starting values for any animatable property.