- Home
- Skills
- Raphaelsalaja
- Userinterface Wiki
- Mastering Animate Presence
mastering-animate-presence_skill
- TypeScript
253
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill raphaelsalaja/userinterface-wiki --skill mastering-animate-presence- SKILL.md6.9 KB
Overview
This skill audits TypeScript Motion/Framer Motion code for AnimatePresence best practices, focusing on exit animations, presence hooks, mode selection, and nested exits. It reports concrete findings in file:line format and produces a summary of rule counts and severities. Use it to catch runtime animation bugs and accessibility/interactivity regressions before release.
How this skill works
It scans the specified files or file patterns and checks each motion component against a defined rule set for exit props, keys, presence hooks, mode usage, and nested-propagation. For each violation it emits a file:line entry with a rule id and short description. After collecting findings it outputs a compact summary table with counts and severity guidance.
When to use it
- Review exit animations for components and modal dialogs.
- Audit lists and reordering animations before shipping UI changes.
- Validate usePresence / useIsPresent usage in child components.
- Check AnimatePresence mode and timing for perceived performance.
- Confirm nested AnimatePresence propagate and timing coordination.
Best practices
- Always wrap conditionally rendered motion elements in AnimatePresence and give them explicit exit props.
- Give dynamic children unique stable keys (avoid array index) to preserve predictable exits.
- Use useIsPresent/usePresence inside the child component and call safeToRemove after async cleanup.
- Adjust durations when mode="wait" because it effectively doubles perceived time; reduce per-element duration.
- Use propagate on nested AnimatePresence and coordinate parent/child exit durations to avoid premature child removal.
Example use cases
- CI pre-merge check to find missing exit props and unwrapped motion elements.
- Code review helper for modal implementations ensuring interactions are disabled during exit.
- List-reordering audit to recommend mode="popLayout" and avoid layout conflicts.
- Refactor validation to ensure usePresence callers call safeToRemove after async work.
FAQ
It emits lines like file:line - [rule-id] short description and a final summary table with rule counts and severity.
Can it scan only specific files or patterns?
Yes — you provide file paths or glob patterns and it will restrict analysis to those files.