UNPKG

2.08 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { OverridableStringUnion } from '@mui/types';
4import { Theme } from '..';
5import { OverridableComponent, OverrideProps } from '../OverridableComponent';
6import { SkeletonClasses } from './skeletonClasses';
7
8export interface SkeletonPropsVariantOverrides {}
9
10export interface SkeletonOwnProps {
11 /**
12 * The animation.
13 * If `false` the animation effect is disabled.
14 * @default 'pulse'
15 */
16 animation?: 'pulse' | 'wave' | false;
17 /**
18 * Optional children to infer width and height from.
19 */
20 children?: React.ReactNode;
21 /**
22 * Override or extend the styles applied to the component.
23 */
24 classes?: Partial<SkeletonClasses>;
25 /**
26 * Height of the skeleton.
27 * Useful when you don't want to adapt the skeleton to a text element but for instance a card.
28 */
29 height?: number | string;
30 /**
31 * The system prop that allows defining system overrides as well as additional CSS styles.
32 */
33 sx?: SxProps<Theme>;
34 /**
35 * The type of content that will be rendered.
36 * @default 'text'
37 */
38 variant?: OverridableStringUnion<
39 'text' | 'rectangular' | 'rounded' | 'circular',
40 SkeletonPropsVariantOverrides
41 >;
42 /**
43 * Width of the skeleton.
44 * Useful when the skeleton is inside an inline element with no width of its own.
45 */
46 width?: number | string;
47}
48
49export interface SkeletonTypeMap<
50 AdditionalProps = {},
51 RootComponent extends React.ElementType = 'span',
52> {
53 props: AdditionalProps & SkeletonOwnProps;
54 defaultComponent: RootComponent;
55}
56
57/**
58 *
59 * Demos:
60 *
61 * - [Skeleton](https://mui.com/material-ui/react-skeleton/)
62 *
63 * API:
64 *
65 * - [Skeleton API](https://mui.com/material-ui/api/skeleton/)
66 */
67declare const Skeleton: OverridableComponent<SkeletonTypeMap>;
68
69export type SkeletonProps<
70 RootComponent extends React.ElementType = SkeletonTypeMap['defaultComponent'],
71 AdditionalProps = {},
72> = OverrideProps<SkeletonTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
73 component?: React.ElementType;
74};
75
76export default Skeleton;