UNPKG

2.01 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { TransitionProps } from '../transitions/transition';
4import { PaperProps } from '../Paper';
5
6export interface ExpansionPanelProps
7 extends StandardProps<PaperProps, ExpansionPanelClassKey, 'onChange'> {
8 /**
9 * The content of the expansion panel.
10 */
11 children: NonNullable<React.ReactNode>;
12 /**
13 * If `true`, expands the panel by default.
14 */
15 defaultExpanded?: boolean;
16 /**
17 * If `true`, the panel will be displayed in a disabled state.
18 */
19 disabled?: boolean;
20 /**
21 * If `true`, expands the panel, otherwise collapse it.
22 * Setting this prop enables control over the panel.
23 */
24 expanded?: boolean;
25 /**
26 * Callback fired when the expand/collapse state is changed.
27 *
28 * @param {object} event The event source of the callback.
29 * @param {boolean} expanded The `expanded` state of the panel.
30 */
31 onChange?: (event: React.ChangeEvent<{}>, expanded: boolean) => void;
32 /**
33 * The component used for the collapse effect.
34 * [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
35 */
36 TransitionComponent?: React.ComponentType<
37 TransitionProps & { children?: React.ReactElement<any, any> }
38 >;
39 /**
40 * Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.
41 */
42 TransitionProps?: TransitionProps;
43}
44
45export type ExpansionPanelClassKey = 'root' | 'rounded' | 'expanded' | 'disabled';
46
47/**
48 * ⚠️ The ExpansionPanel component was renamed to Accordion to use a more common naming convention.
49 *
50 * You should use `import { Accordion } from '@material-ui/core'`
51 * or `import Accordion from '@material-ui/core/Accordion'`.
52 * API:
53 *
54 * - [ExpansionPanel API](https://mui.com/api/expansion-panel/)
55 * - inherits [Paper API](https://mui.com/api/paper/)
56 */
57export default function ExpansionPanel(props: ExpansionPanelProps): JSX.Element;