# Skeleton

A pulsing grey block that holds the place of content while it loads.

This is the HTML to build it with `dex.css`, for work outside the Dex codebase. Read https://brand.meetdex.ai/design.md first: it says how to set up a page and how to use the stylesheet. The page at https://brand.meetdex.ai/components/skeleton shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

A `dex-skeleton` has no size of its own: give each block a width and height with layout CSS of your own. It pulses, and stays still for anyone who has reduced motion on.

```html
<div aria-busy="true" aria-label="Loading your matches" style="display: flex; gap: 0.75rem; align-items: center">
  <div class="dex-skeleton" aria-hidden="true" style="width: 2.5rem; height: 2.5rem; border-radius: var(--dex-radius-full)"></div>
  <div style="display: grid; gap: 0.5rem; flex: 1">
    <div class="dex-skeleton" aria-hidden="true" style="height: 1rem; width: 60%"></div>
    <div class="dex-skeleton" aria-hidden="true" style="height: 1rem; width: 40%"></div>
  </div>
</div>
```

- **Avatar and text**: a round block (`border-radius: var(--dex-radius-full)`) beside lines of text, as above.
- **Card**: a `dex-card` holding blocks for its title, its lines and its button, laid out as the real card is.
- **In place of content**: each block takes the size of the line it stands in for (a line of 14px text is about 1.25rem tall), so nothing moves when the content arrives.

## Rules

- The default radius is 8px (`md`). Change it only where the real thing is shaped differently, such as a round avatar.
- Skeletons are for part of a page that is loading. A whole page that is loading shows a single loading state instead.
- Mark the loading area with `aria-busy="true"` and hide the blocks from screen readers.
- Swap the skeleton for the content in place, at the same size.
