Componentes
Skeleton
Formas de marcador de posición para contenido que se está cargando.
Compatible con servidor (sin "use client")
import.tsx
skeleton-loading.tsx
Editar en GitHubPropósito
Skeleton muestra la forma aproximada del contenido mientras se carga.
Importación
import { Skeleton } from "@neshel-ui/components";Uso
Vista previa: skeleton-loading
import { Skeleton } from "@neshel-ui/components";
import { Inline, Stack } from "@neshel-ui/layout";
export default function SkeletonLoading() {
return (
// The region announces its busy state; the skeletons themselves are aria-hidden.
<section aria-busy="true" aria-label="Loading profile">
<Stack space="4">
<Inline space="3" alignY="center">
<Skeleton shape="circle" width={48} />
<Stack space="2" className="flex-1">
<Skeleton shape="text" width="60%" />
<Skeleton shape="text" width="40%" />
</Stack>
</Inline>
<Skeleton height={96} />
</Stack>
</section>
);
}API
SkeletonProps
| Prop | Tipo | Predeterminado | Descripción |
|---|---|---|---|
| height | number | string | — | Altura; los números son píxeles. |
| ref | Ref<HTMLSpanElement> | — | — |
| shape | "rectangle" | "circle" | "text" | "rectangle" | Forma del marcador ("rectangle" por defecto). |
| width | number | string | — | Ancho; los números son píxeles. |
También acepta las props de: React DOM attributes.
width y height aceptan números (píxeles) o longitudes CSS. La animación de pulso se detiene con
prefers-reduced-motion: reduce.
Accesibilidad
Los skeletons son siempre aria-hidden="true". Marca la región que se carga con aria-busy="true" y
una etiqueta, y anuncia cuándo termina si es relevante.
Errores habituales
- Esperar que un skeleton anuncie «cargando»: por diseño es invisible para las tecnologías de apoyo.