Nested Animated Components: Reusing Motion Inside Larger Designs
How to build animated components that nest inside each other: what to expose as inputs, how parent and child states talk, and how to avoid tangled designs.
Core Takeaway
Nested animated components are reusable pieces, such as a button, an icon or a character, placed inside a larger animated design. Each child owns its own states and exposes a few inputs; the parent sets those inputs rather than reaching inside. This keeps designs reusable, lets one fix update every instance, and stops complex scenes from turning into one tangled timeline.
Why nest at all
Without nesting, a dashboard with eight animated toggles contains eight copies of the toggle animation. Change the easing and you change it eight times. Components fix this the same way they do in Figma or React: define once, place many instances, override a few properties per instance.
Give each component a small interface
Decide what the outside world is allowed to change. A good animated component exposes a handful of inputs and events, and keeps everything else private.
- Inputs: on/off, value, variant, colour, label text
- Events: pressed, completed, value changed
- Private: timelines, internal states, easing details
Parent and child communication
Let data flow down and events flow up. The parent sets a child's inputs; the child reports events, and the parent decides what happens next. Avoid children changing each other directly, which creates hidden dependencies that are hard to debug once there are several levels.
Keep nesting shallow
Two or three levels is usually enough: a screen contains cards, cards contain buttons and icons. Deeper nesting makes it hard to find where a state is set and can affect performance when every level runs its own state machine. Profile scenes with many instances on a mid-range phone.
Building this in ExodeUI
ExodeUI, which we make, is built around this model: components with their own state machines, a small set of inputs and events, nested inside larger scenes. Everything lives in one open .exode JSON file, so developers can review it and AI coding tools can edit it through the ExodeUI MCP server.
Key Principles to Remember
- Define once, place many instances, override a few inputs
- Expose a small set of inputs and events per component
- Data flows down, events flow up
- Keep nesting to two or three levels and profile instance-heavy scenes
Frequently Asked Questions
Sources
- Guide to components in Figma — Figma Help Center
- Design Systems 101 — Nielsen Norman Group