UNPKG

1.35 kBTypeScriptView Raw
1import * as React from "react";
2import * as AnimateHeight from "react-animate-height";
3import { BoxProps } from "../Box";
4
5type AnimateHeightProps = Pick<
6 AnimateHeight.AnimateHeightProps,
7 | "animationStateClasses"
8 | "applyInlineTransitions"
9 | "delay"
10 | "easing"
11 | "style"
12 | "children"
13>;
14
15export interface ICollapse {
16 /**
17 * If `true`, the content will be visible
18 */
19 isOpen?: boolean;
20 /**
21 * If `true`, the opacity of the content will be animated
22 */
23 animateOpacity?: boolean;
24 /**
25 * The duration of the animation in `ms`
26 */
27 duration?: number;
28 /**
29 * The height you want the content in it's collapsed state. Set to `0` by default
30 */
31 startingHeight?: number | string;
32 /**
33 * The height you want the content in it's expanded state. Set to `auto` by default
34 */
35 endingHeight?: number | string;
36 /**
37 * The function to be called when the collapse animation starts. It provides the `newHeight` as an argument
38 */
39 onAnimationEnd?(props: { newHeight: number }): void;
40 /**
41 * The function to be called when the collapse animation ends. It provides the `newHeight` as an argument
42 */
43 onAnimationStart?(props: { newHeight: number }): void;
44}
45
46export type CollapseProps = AnimateHeightProps & ICollapse & BoxProps;
47
48declare const Collapse: React.FC<CollapseProps>;
49
50export default Collapse;