Animations
Soft UI uses motion to enhance usability and delight. Follow these guidelines to create animations that feel fast, natural, and accessible.Core Principles
- UI animations must not exceed 300ms - Keep the interface feeling fast and responsive
- Prefer spring animations - More natural feel than easing curves
- Avoid bouncy springs - Unless working with drag gestures
- Animate from the trigger - Set
transform-originto animate from the source element
Duration & Timing
| Context | Recommendation | Duration |
|---|---|---|
| Hover transitions | transition: property 200ms ease | 200ms |
| Micro-interactions | Fast, snappy feedback | 150ms or less |
| Standard UI elements | Buttons, toggles, small state changes | 200-250ms |
| Modals/drawers | Enter/exit animations | 250-300ms max |
Easing Functions
Use custom easing functions over built-in CSS easings for more natural motion.ease-out (Elements entering/exiting, user interactions)
Best for elements appearing or responding to user input:ease-in-out (Elements moving within the screen)
Best for elements transitioning between states:ease-in (Avoid - makes UI feel slow)
Generally avoided as it makes UI feel sluggish:Usage Example
Spring Animations
Spring animations using Framer Motion or Motion library provide more natural movement.Configuration
Always usebounce and duration instead of stiffness, mass, damping. This is more intuitive and easier to adjust.
Standard Presets
| Name | Config | Use Cases |
|---|---|---|
| Instant/Snappy | bounce: 0, duration: 0.15 | Micro-interactions, icon swaps, tooltips |
| Fast/Responsive | bounce: 0, duration: 0.2 | Buttons, toggles, small state changes |
| Smooth/Subtle | bounce: 0.1, duration: 0.25 | Modals, dropdowns, panels |
| Expressive | bounce: 0.2, duration: 0.3 | Onboarding, celebrations, attention-grabbing |
Real-World Examples
Base UI Integration
Soft UI components use Base UI primitives. Animate them using theasChild pattern.
Adding Animations to Components
Exit & Layout Animations
For exit animations, hoist state and useAnimatePresence with forceMount:
Backdrop Animations
Performance Best Practices
Do
- Animate
opacityandtransformproperties - GPU accelerated - Use
transforminstead ofx/yfor hardware acceleration - Keep blur values ≤ 20px - Larger values hurt performance
- Use
will-changesparingly - Only fortransform,opacity,clipPath,filter
Don’t
- Animate
top,left,width,height- Usetransforminstead - Animate drag gestures with CSS variables - Use transform
- Overuse
will-change- Adds memory overhead
Transform Origin
Animate from the trigger element for better UX:Quick Reference
| Animation Type | Duration | Easing/Spring |
|---|---|---|
| Hover states | 200ms | ease or ease-out |
| Button press | 150ms | bounce: 0, duration: 0.15 |
| Modal enter | 250ms | bounce: 0.1, duration: 0.25 |
| Modal exit | 200ms | bounce: 0, duration: 0.2 |
| Dropdown | 200ms | bounce: 0, duration: 0.2 |
| Toast enter | 250ms | bounce: 0.1, duration: 0.25 |
| Tooltip | 150ms | bounce: 0, duration: 0.15 |