- Inicio
- Primitivas
- Skeleton
- Ejemplos
Skeleton
Ejemplo básico de skeleton demostrando el comportamiento principal.
Ejemplos
import * as Skeleton from "@solidiom/skeleton"
;<Skeleton.Root>Contenido de Skeleton</Skeleton.Root>Ver código fuente
export function Root(props: SkeletonRootProps) {
const variant = () => props.variant ?? "text"
const computedStyle = (): JSX.CSSProperties | string => {
const w = props.width
const h = props.height
if (!w && !h) return props.style ?? {}
const base: JSX.CSSProperties = typeof props.style === "object" ? (props.style ?? {}) : {}
return {
...base,
...(w != null ? { width: typeof w === "number" ? `${w}px` : w } : {}),
...(h != null ? { height: typeof h === "number" ? `${h}px` : h } : {}),
}
}
return (
<div
aria-hidden="true"
class={props.class}
style={computedStyle()}
data-variant={variant()}
{...applySemanticAttrs({ scope: "skeleton", part: "root" })}
/>
)
}