Usage
Transition is a headless component that manages enter/exit animations using CSS properties. It uses a render prop pattern, giving you full control over what and how to render during different animation phases.Examples
Fade Transition
Slide Up Transition
Scale Transition
Modal with Overlay
Different Enter/Exit Durations
With Enter Delay
Keep Mounted
Props
Whether the child element should be visible. Controls the enter/exit animation.
The animation preset to use:
fade: Opacity onlyslide-up: Slides up with fadeslide-down: Slides down with fadescale: Scales with faderotate-left: Rotates and scales with fade
Enter transition duration in milliseconds.
Exit transition duration in milliseconds. If not provided, defaults to
duration.Delay before the enter animation starts, in milliseconds.
If true, the component stays mounted in the DOM when unmounted (with
display: none). Useful for maintaining component state.Render prop that receives:
styles: CSS properties to apply for the current animation phasephase: Current phase ('unmounted','entering','entered','leaving')
Transition Phases
The component goes through these phases:- unmounted: Component is not rendered (unless
keepMountedis true) - entering: Component is animating in
- entered: Component is fully visible
- leaving: Component is animating out
Custom Transitions
While the component provides built-in presets, you can create custom animations by using the phase parameter:Client-Side Only
Transition is marked with'use client' directive and manages animation state using React hooks. It’s designed for client-side rendering.