UNPKG

2.19 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { Theme } from '../styles/createTheme';
4import { TransitionProps } from '../transitions/transition';
5
6export interface CollapseProps extends StandardProps<TransitionProps, CollapseClassKey, 'timeout'> {
7 /**
8 * The content node to be collapsed.
9 */
10 children?: React.ReactNode;
11 /**
12 * The height of the container when collapsed.
13 * @deprecated The prop was renamed to support the addition of horizontal orientation, use `collapsedSize` instead.
14 */
15 collapsedHeight?: string | number;
16 /**
17 * The height of the container when collapsed.
18 */
19 collapsedSize?: string | number;
20 /**
21 * The component used for the root node.
22 * Either a string to use a HTML element or a component.
23 */
24 component?: React.ElementType<TransitionProps>;
25 /**
26 * Enable this prop if you encounter 'Function components cannot be given refs',
27 * use `unstable_createStrictModeTheme`,
28 * and can't forward the ref in the passed `Component`.
29 */
30 disableStrictModeCompat?: boolean;
31 /**
32 * If `true`, the component will transition in.
33 */
34 in?: boolean;
35 /**
36 * The duration for the transition, in milliseconds.
37 * You may specify a single timeout for all transitions, or individually with an object.
38 *
39 * Set to 'auto' to automatically calculate transition time based on height.
40 */
41 timeout?: TransitionProps['timeout'] | 'auto';
42}
43
44export type CollapseClassKey = 'root' | 'entered' | 'hidden' | 'wrapper' | 'wrapperInner';
45
46/**
47 * The Collapse transition is used by the
48 * [Vertical Stepper](https://mui.com/components/steppers/#vertical-stepper) StepContent component.
49 * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
50 * Demos:
51 *
52 * - [Cards](https://mui.com/components/cards/)
53 * - [Lists](https://mui.com/components/lists/)
54 * - [Transitions](https://mui.com/components/transitions/)
55 *
56 * API:
57 *
58 * - [Collapse API](https://mui.com/api/collapse/)
59 * - inherits [Transition API](https://reactcommunity.org/react-transition-group/transition#Transition-props)
60 */
61
62export default function Collapse(props: CollapseProps): JSX.Element;