🎉 Material UI v4 is out now! Check out the announcement blog post →
Collapse

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 Component '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.

Any other properties supplied will be spread 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.
wrapper Styles applied to the outer wrapper element.
wrapperInner Styles applied to the inner wrapper element.

Have a look at overriding 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.

Demos