Animate Layout

Animate width and height of components as they mount and unmount

import { AnimateLayout } from "@plexui/ui/components/Transition";

Use when transitions should affect the layout of surrounding DOM nodes (e.g. expanding/collapsing content).

Gotchas

  • <AnimateLayout> provides a wrapping element, which className and layout transition properties are applied to.
  • Avoid box model properties on className, like margin, padding, border. These are additive to the height: 0 empty state and cannot be properly animated.
  • Avoid box-shadow on className, as it will be visible during the empty state.
  • Use padding on children (via transitionClassName) instead of margin on the wrapper.

Examples

Overview

<AnimateLayout> is an abstraction around <TransitionGroup> that also animates height and width of transitions.

It supports the same props as <Animate> plus layoutEnter, layoutExit, and layoutMove for layout timing.

Height

By default, animates the height of the component as it enters and exits.

Width

Use dimension="width" to animate width.

Accordion

Wrap accordion content with <AnimateLayout> for smooth height animation.

Which model should I use?
Do you offer an enterprise package or SLAs?
Will I be charged for API usage in the Playground?

Talk button

Animate width with consistent height. Use transitionClassName to match the button's flex structure.

Reference

PropTypeDefaultDescription
classNamestringClass applied to the wrapper element
transitionClassNamestringClass applied to the inner TransitionGroup; use for padding on children
dimension"height" | "width""height"Which property to animate during transitions
enterTransitionDefinitionEnter transition (opacity, x, y, scale, etc.)
exitTransitionDefinitionExit transition
initialInitialTransitionDefinitionState before enter
layoutEnterLayoutTransitionDefinitionTiming for layout enter (duration, delay, timingFunction)
layoutExitLayoutTransitionDefinitionTiming for layout exit
layoutMoveLayoutTransitionDefinitionTiming for layout move
hideOverflowbooleanfalseApply overflow: hidden to the wrapper
itemAnchor"start" | "end""start"Which side of the container items pin to during enter/exit
preventInitialTransitionbooleantrueWhen false, children run enter on initial mount
forceCompositeLayerbooleanfalseApplies will-change; use with caution