Skip to content
Merged
1 change: 1 addition & 0 deletions docs/pages/api/skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi

| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| <span class="prop-name">animationDelay</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Delays the animation of the skeleton. Useful when you have multiple skeletons, and need them to pulse out of sync. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'div'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">disableAnimate</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true` the animation effect is disabled. |
Expand Down
24 changes: 24 additions & 0 deletions docs/src/pages/components/skeleton/Delay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import Skeleton from '@material-ui/lab/Skeleton';

export default function Variants() {
return (
<div>
<Skeleton variant="rect" width={210} height={118} />
<Skeleton
variant="rect"
width={210}
height={118}
animationDelay="0.1s"
style={{ marginTop: 5 }}
/>
<Skeleton
variant="rect"
width={210}
height={118}
animationDelay="0.2s"
style={{ marginTop: 5 }}
/>
</div>
);
}
24 changes: 24 additions & 0 deletions docs/src/pages/components/skeleton/Delay.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';
import Skeleton from '@material-ui/lab/Skeleton';

export default function Variants() {
return (
<div>
<Skeleton variant="rect" width={210} height={118} />
<Skeleton
variant="rect"
width={210}
height={118}
animationDelay="0.1s"
style={{ marginTop: 5 }}
/>
<Skeleton
variant="rect"
width={210}
height={118}
animationDelay="0.2s"
style={{ marginTop: 5 }}
/>
</div>
);
}
4 changes: 4 additions & 0 deletions docs/src/pages/components/skeleton/skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ The component supports 3 variants.
## Facebook example

{{"demo": "pages/components/skeleton/Facebook.js", "defaultCodeOpen": false, "bg": true}}

## Delay example

{{"demo": "pages/components/skeleton/Delay.js", "defaultCodeOpen": false}}
1 change: 1 addition & 0 deletions packages/material-ui-lab/src/Skeleton/Skeleton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OverridableComponent, OverrideProps } from '@material-ui/core/Overridab

export interface SkeletonTypeMap<P = {}, D extends React.ElementType = 'hr'> {
props: P & {
animationDelay?: string;
disableAnimate?: boolean;
height?: number | string;
variant?: 'text' | 'rect' | 'circle';
Expand Down
7 changes: 7 additions & 0 deletions packages/material-ui-lab/src/Skeleton/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const styles = theme => ({

const Skeleton = React.forwardRef(function Skeleton(props, ref) {
const {
animationDelay,
classes,
className,
component: Component = 'div',
Expand All @@ -72,13 +73,19 @@ const Skeleton = React.forwardRef(function Skeleton(props, ref) {
style={{
width,
height,
animationDelay,
...other.style,
}}
/>
);
});

Skeleton.propTypes = {
/**
* Delays the animation of the skeleton.
* Useful when you have multiple skeletons, and need them to pulse out of sync.
*/
animationDelay: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
Expand Down