Skeleton
Mostrar una vista previa de su contenido antes de que se carguen los datos para reducir la frustración en tiempo de carga.
Es posible que los datos de sus componentes no estén disponibles inmediatamente. You can improve the perceived responsiveness of the page by using skeletons. Parece que las cosas están sucediendo inmediatamente, entonces la información se muestra incrementalmente en la pantalla (Cf. Evitar el Spinner).
Implementación
El componente está diseñado para ser utilizado directamente en sus componentes. Por ejemplo:
{
item ? {
item ? {item ? (
<img style={{ width: 210, height: 118 }} alt={item.title} src={item.src} />
) : (
<Skeleton variant="rect" width={210} height={118} />
)}
Variantes
El componente soporta 3 variantes de forma.
<Skeleton variant="text" />
<Skeleton variant="circular" width={40} height={40} />
<Skeleton variant="rectangular" width={210} height={118} />
Animaciones
By default, the skeleton pulsate, but you can change the animation for a wave or disable it entirely.
<Skeleton />
<Skeleton animation="wave" />
<Skeleton animation={false} />
Don Diablo @ Tomorrowland Main Stage 2019 | Official…
Queen - Greatest Hits
Calvin Harris, Sam Smith - Promises (Official Video)
Why First Minister of Scotland Nicola Sturgeon thinks GDP is the wrong measure of a country's success:
Dimensiones inferentes
In addition to accepting width
and height
props, the component can also infer the dimensions.
It works well when it comes to typography as its height is set using em
units.
<Typography variant="h1">
{loading ? <Skeleton /> : 'h1'}
</Typography> <Skeleton /> : 'h1'}</Typography> <Skeleton /> : 'h1'}</Typography>
But when it comes to other components, you may not want to repeat the width and height. In these instances, you can pass children
and it will infer its width and height from them.
loading ? (
<Skeleton variant="circular">
<Avatar />
</Skeleton>
) : (
<Avatar src={data.avatar} />
);
.
Ted
Accesibilidad
Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load.
The background color of the skeleton uses the least amount of luminance to be visible in good conditions (good ambient light, good screen, no visual impairments).
ARIA
None.
Teclado
The skeleton is not focusable.