Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

AnimateHeight

The AnimateHeight component animates its children between a collapsed height and their natural height. It is useful when building disclosure controls and expandable regions.

Import

1
import { AnimateHeight } from '@payloadcms/ui'

Interactive example

Loading component example…

The control that changes height remains your responsibility. Give that control an accessible label and expose its expanded state with aria-expanded when it controls a disclosure region.

Common props

These are the props most commonly used with this component. See its exported types in @payloadcms/ui for the complete list.

Prop

Type

Default

Description

children *

ReactNode

Content whose height is animated.

height

number | 'auto'

Target height. Use 0 to collapse the content.

duration

number

300

Animation duration in milliseconds.

id

string

Sets the wrapper element ID.

className

string

Adds a class to the wrapper element.

* An asterisk denotes that a prop is required.

Was this page helpful?

Next

Banner