Skip to main content
AnimatedIconCrossfade crossfades between activeIcon and inactiveIcon node content according to isActive. It does not own the action or state. Compose it inside a labeled Button.

Usage

Both nodes stay mounted as isActive changes, preserving their local state. The layers animate opacity and scale, and disable transitions for reduced motion. Both layers are decorative; keep the accessible action name on the surrounding control. For a standalone labeled image, set role="img" and aria-label on the root. Native attributes, events, className, style, and ref target an inline span, which can sit inside a button. render replaces that target through Base UI composition. The root dimensions default to the small icon theme token. Size each icon node explicitly, and use root width and height styles for larger artwork. Replace ActiveIcon and InactiveIcon constructors with lowercase activeIcon and inactiveIcon nodes. Move the former size option to the node dimensions and root styles.

Props

ReactNode
required
Decorative node content for the active state.
string
CSS class applied to the inline span root.
ReactNode
required
Decorative node content for the inactive state.
boolean
required
Shows activeIcon when true and inactiveIcon otherwise.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>
Replaces the span root while preserving both transition layers.
CSSProperties
Inline styles applied to the root, including width and height.