# Loading

> A complete screen built from AppShell, Badge, Button, Card and 7 more components.

Pattern · Pro kit · [Live page](https://ui.twentyfirst.media/pro/patterns/LoadingScreen/)

## Code

```tsx
import * as React from "react";
import {
  AppShell,
  Badge,
  Button,
  Card,
  EmptyState,
  PageHeader,
  Skeleton,
  Stagger,
  StatTile,
  TintIcon,
} from "@twentyfirstmedia/pro";
import { cardActs } from "./_workspace";

function SkelCard() {
  return (
    <div className="tf-card">
      <div
        className="tf-row"
        style={{
          justifyContent: "space-between",
        }}
      >
        <Skeleton variant="title" width="55%" />
        <Skeleton variant="circle" width={30} />
      </div>
      <Skeleton />
      <Skeleton width="70%" />
      <div className="tf-card-foot">
        <Skeleton width={70} height={26} />
        <div className="tf-row">
          <Skeleton variant="circle" width={30} />
          <Skeleton variant="circle" width={30} />
        </div>
      </div>
    </div>
  );
}
function App() {
  const done = React.useState(false);
  React.useEffect(() => {
    const t = setTimeout(() => {
      done[1](true);
    }, 2200);
    return () => {
      clearTimeout(t);
    };
  }, []);
  if (done[0])
    return (
      <AppShell
        brand="Halo"
        tag="Admin"
        user={{ name: "Mara Ellis", email: "mara@halo.app" }}
        active="Projects"
        dock={false}
      >
        <div className="tf-in">
          <PageHeader
            title="Projects"
            subtitle="Loaded — content replaces the skeleton with the normal entrance"
          />
        </div>
        <Stagger
          className="tf-grid"
          style={
            {
              "--cols": "repeat(4, 1fr)",
              "--cols-sm": "repeat(2, minmax(0, 1fr))",
              "--cols-md": "repeat(2, minmax(0, 1fr))",
            } as React.CSSProperties
          }
        >
          <StatTile tint="sky" value="18" label="All projects" />
          <StatTile tint="mint" value="11" label="Live" />
          <StatTile tint="placeholder" value="4" label="Drafts" />
          <StatTile tint="butter" value="€48,210" label="Revenue (MTD)" />
        </Stagger>
        <Stagger
          className="tf-grid"
          style={
            {
              "--cols": "repeat(3, 1fr)",
            } as React.CSSProperties
          }
          delay={200}
        >
          <Card
            title="Quarterly onboarding"
            description="Welcome flow for new workspace admins."
            corner={<TintIcon icon="book" tint="mint" />}
            status={<Badge tone="success">Live</Badge>}
            actions={cardActs()}
          />
          <Card
            tint="lilac"
            title="Pricing page refresh"
            description="New tiers and a comparison table."
            status={<Badge>86 viewing</Badge>}
          />
          <Card
            title="Partner referral program"
            description="Track invites, payouts and tiers."
            corner={<TintIcon icon="users" tint="sky" />}
            status={<Badge tone="success">Live</Badge>}
            actions={cardActs()}
          />
          <EmptyState
            title="No archived projects"
            text="Projects you retire land here, with their history kept."
            icon="folder"
            tint="butter"
            action={
              <Button variant="soft" size="sm">
                View all
              </Button>
            }
          />
        </Stagger>
      </AppShell>
    );
  return (
    <AppShell
      brand="Halo"
      tag="Admin"
      user={{ name: "Mara Ellis", email: "mara@halo.app" }}
      active="Projects"
      dock={false}
    >
      <div
        className="tf-col"
        style={{
          gap: 8,
        }}
      >
        <Skeleton variant="title" width={220} height={28} />
        <Skeleton width={320} />
      </div>
      <div
        className="tf-grid"
        style={
          {
            "--cols": "repeat(4, 1fr)",
            "--cols-sm": "repeat(2, minmax(0, 1fr))",
            "--cols-md": "repeat(2, minmax(0, 1fr))",
          } as React.CSSProperties
        }
      >
        {[0, 1, 2, 3].map((i) => (
          <Skeleton key={i} variant="block" height={84} />
        ))}
      </div>
      <div
        className="tf-grid"
        style={
          {
            "--cols": "repeat(3, 1fr)",
          } as React.CSSProperties
        }
      >
        {[0, 1, 2, 3, 4, 5].map((i) => (
          <SkelCard key={i} />
        ))}
      </div>
    </AppShell>
  );
}
export default function Preview() {
  return <App />;
}
```

## Props

### AppShell

| Prop | Type | Notes |
| --- | --- | --- |
| `active?` | `string` |  |
| `brand?` | `ReactNode` | The product name, or a node (a logo mark with the name; collapsed sidebars show it whole). |
| `tag?` | `string` |  |
| `nav?` | `NavItem[]` |  |
| `user?` | `{ name: string; email?: string }` |  |
| `onNavigate?` | `(label: string) => void` |  |
| `topExtra?` | `ReactNode` |  |
| `sheetStyle?` | `CSSProperties` |  |
| `contentKey?` | `string \| number` |  |
| `side?` | `ReactNode` |  |
| `dock?` | `boolean` |  |
| `dockItems?` | `DockProps["items"]` |  |
| `railTop?` | `RailItem[]` |  |
| `railBottom?` | `RailItem[]` |  |
| `navigation?` | `"top" \| "sidebar"` | `top` (default): navigation in the top bar, tools in the side rail. `sidebar`: a labelled sidebar on the frame, with groups, nesting and a drawer on phones. |
| `sidebarGroups?` | `SidebarGroup[]` | With `navigation="sidebar"`: groups instead of the flat `nav` list. |
| `sidebar?` | `Partial<Omit<SidebarProps, "variant" \| "groups">>` | With `navigation="sidebar"`: more sidebar props (collapsed, storageKey, shortcut, linkAs …). |
| `workspaces?` | `WorkspaceSwitcherProps` | With `navigation="sidebar"`: the workspace switcher at the top instead of the brand. |
| `userMenu?` | `(MenuItem \| "-")[]` | The account menu's entries (with `navigation="sidebar"` at the foot of the sidebar). |
| `children?` | `ReactNode` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Badge

| Prop | Type | Notes |
| --- | --- | --- |
| `tone?` | `Tone` |  |
| `dot?` | `boolean` |  |
| `live?` | `boolean` |  |
| `children?` | `ReactNode` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Button

| Prop | Type | Notes |
| --- | --- | --- |
| `variant?` | `"primary" \| "secondary" \| "soft" \| "ghost" \| "danger" \| "danger-solid"` |  |
| `size?` | `"md" \| "sm"` |  |
| `icon?` | `IconName` |  |
| `iconRight?` | `IconName` |  |
| `disabled?` | `boolean` |  |
| `type?` | `"button" \| "submit" \| "reset"` |  |
| `onClick?` | `(e: MouseEvent<HTMLButtonElement>) => void` |  |
| `children?` | `ReactNode` |  |
| `asChild?` | `boolean` | Render the single child element (a link, a router Link) with the button's look instead of a <button>. |
| `id?` | `string` |  |
| `name?` | `string` | Form field name and value, sent with the form when this button submits it. |
| `value?` | `string` |  |
| `form?` | `string` | The id of the form this button belongs to, when it sits outside it. |
| `title?` | `string` |  |
| `tabIndex?` | `number` |  |
| `autoFocus?` | `boolean` |  |
| `aria-label?` | `string` |  |
| `aria-labelledby?` | `string` |  |
| `aria-describedby?` | `string` |  |
| `aria-expanded?` | `boolean \| "true" \| "false"` | For disclosure and menu triggers: whether what the button controls is open. |
| `aria-controls?` | `string` |  |
| `aria-haspopup?` | `boolean \| "true" \| "false" \| "menu" \| "listbox" \| "tree" \| "grid" \| "dialog"` |  |
| `aria-pressed?` | `boolean \| "true" \| "false" \| "mixed"` | For toggle buttons. |
| `aria-current?` | `boolean \| "true" \| "false" \| "page" \| "step" \| "location" \| "date" \| "time"` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Card

| Prop | Type | Notes |
| --- | --- | --- |
| `title?` | `string` |  |
| `description?` | `string` |  |
| `meta?` | `string[]` |  |
| `corner?` | `ReactNode` |  |
| `status?` | `ReactNode` |  |
| `actions?` | `ReactNode[]` |  |
| `tint?` | `Tint \| "surface"` |  |
| `onClick?` | `() => void` |  |
| `children?` | `ReactNode` |  |
| `eyebrow?` | `ReactNode` |  |
| `surface?` | `Surface` | `"glass"`: translucent glass over what is behind (maps, 3D, video, photos); `"solid"` opts out inside a glass `UIProvider`. |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### EmptyState

| Prop | Type | Notes |
| --- | --- | --- |
| `title` | `string` | Required |
| `text?` | `string` |  |
| `icon?` | `IconName` |  |
| `tint?` | `Tint` |  |
| `action?` | `ReactNode` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### IconButton

| Prop | Type | Notes |
| --- | --- | --- |
| `icon` | `IconName` | Required |
| `label` | `string` | Accessible name and tooltip (`aria-label` and `title`); `aria-label` or `title` override them. |
| `variant?` | `"soft" \| "solid" \| "outline" \| "ghost"` |  |
| `size?` | `"sm" \| "md" \| "lg"` |  |
| `type?` | `"button" \| "submit" \| "reset"` |  |
| `onClick?` | `(e: MouseEvent<HTMLButtonElement>) => void` |  |
| `disabled?` | `boolean` |  |
| `asChild?` | `boolean` | Render the single child element (a link) with the button's look; the icon is placed inside it. |
| `children?` | `ReactNode` |  |
| `id?` | `string` |  |
| `name?` | `string` | Form field name and value, sent with the form when this button submits it. |
| `value?` | `string` |  |
| `form?` | `string` | The id of the form this button belongs to, when it sits outside it. |
| `title?` | `string` |  |
| `tabIndex?` | `number` |  |
| `autoFocus?` | `boolean` |  |
| `aria-label?` | `string` |  |
| `aria-labelledby?` | `string` |  |
| `aria-describedby?` | `string` |  |
| `aria-expanded?` | `boolean \| "true" \| "false"` | For disclosure and menu triggers: whether what the button controls is open. |
| `aria-controls?` | `string` |  |
| `aria-haspopup?` | `boolean \| "true" \| "false" \| "menu" \| "listbox" \| "tree" \| "grid" \| "dialog"` |  |
| `aria-pressed?` | `boolean \| "true" \| "false" \| "mixed"` | For toggle buttons. |
| `aria-current?` | `boolean \| "true" \| "false" \| "page" \| "step" \| "location" \| "date" \| "time"` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### PageHeader

| Prop | Type | Notes |
| --- | --- | --- |
| `crumbs?` | `(string \| Crumb)[]` | A breadcrumb above the title (see `Breadcrumb`): labels, or items with `href`/`onClick`. |
| `crumbLinkAs?` | `ElementType` | The element crumb links render as, e.g. Next.js `Link`. |
| `title` | `string` | Required |
| `subtitle?` | `string` |  |
| `actions?` | `ReactNode[]` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Skeleton

| Prop | Type | Notes |
| --- | --- | --- |
| `variant?` | `"text" \| "title" \| "circle" \| "block"` |  |
| `width?` | `number \| string` |  |
| `height?` | `number \| string` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### Stagger

| Prop | Type | Notes |
| --- | --- | --- |
| `as?` | `string` |  |
| `className?` | `string` |  |
| `style?` | `CSSProperties` |  |
| `delay?` | `number` | Extra delay before the first child, in ms. |
| `reveal?` | `boolean` | Below the fold, wait until the group scrolls into view (default true). |
| `children?` | `ReactNode` |  |

### StatTile

| Prop | Type | Notes |
| --- | --- | --- |
| `value` | `ReactNode` | Required |
| `label` | `string` | Required |
| `tint?` | `Tint \| "surface" \| "placeholder"` |  |
| `delta?` | `string` |  |
| `delay?` | `number` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |

### TintIcon

| Prop | Type | Notes |
| --- | --- | --- |
| `icon` | `IconName` | Required |
| `tint?` | `Tint \| "plain"` |  |
| `label?` | `string` |  |
| `size?` | `number` |  |
| `className?` | `string` | Extra class on the root element. |
| `style?` | `CSSProperties` | Inline style on the root element. |
