Transition Panel
Swap between panels with a directional slide while the container springs to each panel's height.
Overview
Transition Panel shows one of several panels at a time. When the active index changes, the outgoing panel slides and blurs away in the direction of travel, the incoming one slides in from the other side, and the container springs to the new panel's height so content below moves smoothly. Use it for steppers, segmented views, and settings sections whose panels differ in length.
Installation
Usage
import { TransitionPanel } from "@/components/animated/transition-panel"
const [active, setActive] = useState(0)
<TransitionPanel activeIndex={active}>
<div>Account</div>
<div>Invite</div>
<div>Connect</div>
</TransitionPanel>Pass your own variants with enter, center, and exit keys to change the motion. Each variant can be a function of the direction, which is 1 when moving to a later panel and -1 when moving back.
Accessibility
Transition Panel only animates; it does not add roles. When the panels belong to a tab-like control, give the control role="tablist" semantics or use Animated Tabs. With reduced motion enabled, panels cross-fade and the height changes immediately.