AgentStack
SKILL verified MIT Self-run

Framer Motion Layout

skill-c-jeril-framer-motion-skills-framer-motion-layout · by C-Jeril

Official Framer Motion skill for layout animations — shared layout transitions, layoutId, exit animations, AnimatePresence. Use when building shared element transitions, layout animations, reorderable lists, or when asking about Framer Motion layout, layoutId, or shared transitions.

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-c-jeril-framer-motion-skills-framer-motion-layout

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Framer Motion Layout? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Framer Motion Layout Animations

When to Use This Skill

Apply when implementing shared element transitions, layout animations for reordering, or coordinated mount/unmount animations. When the user asks about Framer Motion layout animations, layoutId, or AnimatePresence.

Related skills: For core animation use framer-motion-core; for variants use framer-motion-variants; for React integration use framer-motion-react.

Layout Prop

The layout prop enables automatic position animations when layout changes:


  {items.map(item => (
    
  ))}

Layout Modes

| Mode | Behavior | |------|----------| | true | Animate position and size | | "position" | Animate only position | | "size" | Animate only size |

layoutId for Shared Element Transitions

layoutId enables smooth transitions between elements in different components:

Page Transitions

// Page A
function CardA() {
  return ;
}

// Page B
function CardB() {
  return ;
}

When CardA unmounts and CardB mounts with the same layoutId, Framer Motion animates the element smoothly between positions.

Modal Overlays

function ListItem({ item, onClick }) {
  return (
    
      {item.name}
    
  );
}

function Modal({ item }) {
  return (
    
      {item.name}
      {item.description}
    
  );
}

AnimatePresence for Layout

AnimatePresence enables exit animations:

import { AnimatePresence, motion } from "framer-motion";

function TodoList({ todos }) {
  return (
    
      
        {todos.map(todo => (
          
        ))}
      
    
  );
}

AnimatePresence Modes


  {isOpen && }

| Mode | Description | |------|-------------| | "sync" | All animations run simultaneously (default) | | "wait" | Exit completes before enter starts | | "popLayout" | Exiting element removed from layout immediately |

Reorderable Lists

Combine layout with drag for reorderable lists:

function ReorderableList({ items, setItems }) {
  return (
    
      {items.map(item => (
         {
            // Calculate new index and update
          }}
          initial={{ opacity: 0, scale: 0.8 }}
          animate={{ opacity: 1, scale: 1 }}
          exit={{ opacity: 0, scale: 0.8 }}
        />
      ))}
    
  );
}

Shared Layout with Grid

function Grid({ items }) {
  return (
    
      {items.map(item => (
        
      ))}
    
  );
}

Exit Animations

Elements must have exit states for AnimatePresence:

Exit with layout

Crossfade with layoutId

When multiple elements share a layoutId at the same level:

function Toggle() {
  const [showA, setShowA] = useState(true);

  return (
    
      {showA ? (
        
      ) : (
        
      )}
    
  );
}

The element smoothly morphs between states including border radius.

Best practices

  • ✅ Use layoutId for shared element transitions between routes/pages.
  • ✅ Wrap animated lists with AnimatePresence for exit animations.
  • ✅ Use layout prop for automatic position animations.
  • ✅ Use AnimatePresence mode="popLayout" for smooth reordering.
  • ✅ Define exit states for components using AnimatePresence.
  • ✅ Use layout on parent containers when children need to animate position.

Do Not

  • ❌ Forget to wrap conditionally rendered animated components with AnimatePresence.
  • ❌ Use the same layoutId on multiple elements at the same level.
  • ❌ Forget to define exit states for components that unmount.
  • ❌ Use layout animations without proper keys on children.
  • ❌ Animate too many layout elements simultaneously — group or stagger.

Learn More

https://www.framer.com/motion/layout-animations/ https://www.framer.com/motion/animate-presence/

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.