DialogSkeleton
The v3 mock's .skel: a 120px block, then lines (every other one shorter), shimmering unless motion is reduced.
import { DialogSkeleton } from '@ergasti/bricks';Examples
Dialog body placeholder
The shape Modal and Drawer draw while loading; you can place it yourself when you load a panel in your own container.
Code
import { DialogSkeleton } from '@ergasti/bricks';
function Placeholder() {
return <div style={{ maxWidth: 420, background: 'var(--card)', borderRadius: 22, padding: 20 }}><DialogSkeleton /></div>;
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key dialog, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
close | Close | اقفل |
loading | Loading… | جارٍ التحميل… |
Design guidance
How the BRICKS design system uses DialogSkeleton. Written in docs/content/components/DialogSkeleton.md; the props above are read from the code, which wins where the two disagree.
The single loading placeholder a drawer or modal shows while its data loads: a 120px block then shimmering lines; Drawer and Modal draw it for you with loading.
DialogSkeleton is the v3 mock's .skel: six grey bars, the first a 120px rounded block (the head tile), the rest 16px lines with every other one at 70 % width. They shimmer unless the user prefers reduced motion. It is one role="status" named "Loading…", so assistive tech hears one announcement instead of six shapes.
Anatomy
- Container (
div.kit-dlg-skel,role="status",aria-label="Loading…",data-skeleton). - Bars (6 ×
i,aria-hidden): first 120px / radius 20; others 16px / radius 8, 14px apart; even ones 70 % wide.
Variants
None.
States
| State | Trigger | Look |
|---|---|---|
| Shimmer | default | 1s linear gradient sweep |
| Reduced motion | prefers-reduced-motion | Static bars |
Usage
Usually implicit:
function CreatorDrawer({ id, onClose }: { id: number | null; onClose: () => void }) {
const drawer = useDrawerResource<{ name: string; joined: string }, { id: number }>(id === null ? null : `/creators/${id}`, id === null ? null : { id });
return (
<Drawer open={drawer.open} loading={drawer.loading} title={drawer.data?.name ?? ''} onClose={onClose}>
{drawer.data && <KeyValue items={[{ label: 'Joined', value: drawer.data.joined }]} />}
</Drawer>
);
}Directly, in your own overlay body:
{loading ? <DialogSkeleton /> : <ReceiptCard {...receipt} />}Where it appears
- Every Brand and PR drawer while its record loads (creator, order, product, payout, challenge).
- Screens: Creators, Payments › Wallet, PR · Creators.
Guidelines
Do
- Use
loadingon Drawer / Modal instead of rendering it yourself. - Show the row's known data (title, avatar) in the header while it loads.
Don't
- Don't use it for page-level loading; use the list's own skeleton (
DataTable loading) orAsyncBlock.
RTL and Arabic
- Bars start at the inline start, so the short lines end on the left in Arabic.
Tokens
None (fixed #EEF0F4 / #F8F9FB gradient).
Accessibility
role="status"with "Loading…" / "جارٍ التحميل…"; bars hidden.
Found in the source
- Roles in the markup:
status,dialog. - ARIA attributes set:
aria-label,aria-hidden,aria-modal,aria-labelledby,aria-busy. - It traps focus while open and returns it on close.
- It locks the page behind it (inert, no scroll) while open.
- Its tests cover: “is a light, labelled modal dialog with a labelled close button and a scrim”; “moves focus in, traps Tab, closes on Escape and returns focus to the opener”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
Drawer,Modal(loading).AsyncBlock: loading/error/empty for blocks.
See also: useFocusTrap · useModalLock · DetailsBars · DetailsDrawer
Source
src/kit/Dialog.tsx (line 43) on GitHub.