UNPKG

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