Skip to content

Collapse API

The API documentation of the Collapse React component. Learn more about the properties and the CSS customization points.

import Collapse from '@material-ui/core/Collapse';

The Collapse transition is used by the Vertical Stepper StepContent component. It uses react-transition-group internally.

Props

Name Type Default Description
children node The content node to be collapsed.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
collapsedHeight string '0px' The height of the container when collapsed.
component elementType 'div' The component used for the root node. Either a string to use a DOM element or a component.
in bool If true, the component will transition in.
timeout union: number |
 { enter?: number, exit?: number } |
 enum: 'auto'

duration.standard The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object.
Set to 'auto' to automatically calculate transition time based on height.

The ref is forwarded to the root element.

Any other properties supplied will be provided to the root element (Transition).

CSS

You can override all the class names injected by Material-UI thanks to the classes property. This property accepts the following keys:

Name Description
container Styles applied to the container element.
entered Styles applied to the container element when the transition has entered.
hidden Styles applied to the container element when the transition has exited and collapsedHeight != 0px.
wrapper Styles applied to the outer wrapper element.
wrapperInner Styles applied to the inner wrapper element.

Have a look at the overriding styles with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiCollapse.

Inheritance

The properties of the Transition component, from react-transition-group, are also available. You can take advantage of this behavior to target nested components.

Notes

The component can cause issues in StrictMode.

Demos