Skeleton
Reserve space while content loads.
Examples
Reserve space while content loads
React code
import { Skeleton } from "@accelerate/react/components";
export function Example() {
return (
<>
<div role="status" aria-label="Loading work items">
<Skeleton></Skeleton>
<Skeleton></Skeleton>
</div>
</>
);
}Angular code
import { Component } from "@angular/core";
import { AccSkeleton } from "@accelerate/angular/components";
@Component({
selector: "app-example",
imports: [
AccSkeleton,
],
template: `
<div role="status" aria-label="Loading work items">
<div accSkeleton></div>
<div accSkeleton></div>
</div>
`,
})
export class Example {}Installation
Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.
- React
@accelerate/ui@0.4.0and@accelerate/react@0.4.0- Angular
@accelerate/ui@0.4.0and@accelerate/angular@0.2.0
Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.
Usage
Decorative loading placeholder. Size it with CSS and put loading status on the containing region.
Import the React component Skeleton from @accelerate/react/components. For Angular, add AccSkeleton to the standalone component’s imports and use <div accSkeleton>.
Examples use these React parts: Skeleton. The Angular examples show the corresponding directives and template hosts.
API reference
- aria-hidden
- Skeleton blocks are decorative.
- Status
- Announce loading from the containing region and replace it with the finished content.