OPERATOR

Skeleton

A Skeleton is only for the eye. It shows where content will appear and says nothing to a screen reader: no role, no name, no text. The area that is loading says Loading <what> once and says when the content has arrived (Announcing a loading area).

Variants

Block sizing

A block bar fills the width of its container. A width makes it narrower; it never makes it wider than its container, so a placeholder sized for a wide layout still fits a narrow one.

A placeholder has no width of its own: put it in a block, a card or a flex column, or give it a width. In a shrink-wrapped box with nothing else in it, a bar with no width has nothing to fill.

Text lines

Announcing a loading area

A screen of six Skeletons must not say "Loading" six times, and a screen with none must not leave a person waiting in silence. So the area that is loading speaks, once, and the placeholders inside it do not:

  1. Mark the area aria-busy while it loads.
  2. Keep one polite status beside the area, not inside it (a busy live region is not announced until it stops being busy). It is in the page before it has anything to say, and visually hidden (sr-only).
  3. Write "Loading tracks." into it when loading starts, and "12 tracks loaded." when the content has arrived. Say a failure with an alert ("Tracks could not be loaded.").
  4. Name the area with words you already have: its heading, caption or label.
  5. Say it only for a load someone asked for: choosing another screen or tab, filtering, paging, retrying. The page coming up is not news. Content that is already there when the area first renders is silent, and so is content that is still loading then: the area is aria-busy and draws its skeletons, but says nothing, and nothing when that first load ends. A failure of the first load is still an alert.

Tracks

  • TRK-0412
  • TRK-0413
  • TRK-0419
  • TRK-0422

The sentences come from a small helper, LoadingNote, which this documentation app keeps next to its examples (the source is below, to copy). OPERATOR's own components follow the same rules where they own the loading area: DataGrid with loading marks its table busy and, for a reload, a page or a filter, says Loading <caption>. and <caption> loaded. 120 rows. once each (its first load is silent), and ComboBox with loading says "Loading options." for a search someone typed (React Aria says how many options arrived).

LoadingNote takes an optional load: what is being loaded, such as the chosen screen. When it changes, someone has asked for something else, and that is announced even if the first load has not finished. The landing page's live screens use it: the screen the page opens with is silent, and choosing another says "Loading Asset Management." and then "Asset Management loaded."

import { Skeleton } from "@oprt/react";

function Tracks() {
  const { tracks, loading, failed } = useTracks();
  return (
    <section aria-labelledby="tracks-title">
      <h2 id="tracks-title">Tracks</h2>
      <LoadingNote
        state={failed ? "error" : loading ? "loading" : "ready"}
        notes={{
          loading: "Loading tracks.",
          ready: `${tracks.length} tracks loaded.`,
          error: "Tracks could not be loaded.",
        }}
      />
      <div aria-busy={loading}>
        {loading ? <Skeleton variant="text" lines={3} /> : <TrackList tracks={tracks} />}
      </div>
    </section>
  );
}

Why the status is written into, not rendered with its text: NVDA and VoiceOver speak text that arrives in a status they already have, and say nothing for a role="status" element that is inserted together with its text, a plain <div role="status"> included. LoadingNote renders the status empty and writes the sentence in, and for the first moment after the area is added to a running page it waits a tenth of a second, because text written in the same frame the status appeared is still taken as arriving with it. An area in the page's first markup is page content and is not held back. An error is an alert, which is spoken when it is inserted.

Source of LoadingNote
"use client";

import { useEffect, useRef, useState, useSyncExternalStore } from "react";

/** How long a status that was just added to a running page waits before it is given its text. */
export const LOADING_NOTE_LEAD_MS = 100;

export type LoadingState = "loading" | "ready" | "error";

export type LoadingNotes = {
  /** Said once when loading starts: "Loading tracks." */
  loading: string;
  /** Said once when the content has arrived: "12 tracks loaded." */
  ready: string;
  /** Said assertively when loading fails. Without it the note has no alert element. */
  error?: string;
};

const noSubscription = () => () => {};

/**
 * What an area that loads says, as the text of two elements: a polite status that is in the page
 * from the first render (Loading, then the arrival) and, if there is an error note, an alert that
 * is added when a load fails.
 *
 * - Skeletons say nothing. The loading area says "Loading <what>" once, and says when the content
 *   has arrived. A screen of six skeletons is one announcement, not six.
 * - Only a load that someone asked for is news (choosing another screen, filtering, paging,
 *   retrying). The page coming up is not: what is loading when the area first renders is the
 *   page's own first load. The area may be `aria-busy` and draw its skeletons, but it says
 *   nothing, and nothing when that load ends. If the first load fails it is still an alert.
 *   `load` names the thing being loaded: when it changes, someone asked for something else, and
 *   that is announced even if the first load has not finished.
 * - A screen reader speaks text that arrives in a status it already has, and nothing for a status
 *   that is inserted together with its text (docs/verification/2026-10-21-screen-readers.md). So
 *   the status is rendered empty and the text is written into it; for the first moment after
 *   the area is added to a running page, even that waits one lead, because text written in the
 *   same frame the status appeared is still seen as arriving with it.
 * - Nothing is said for content that is already loaded when the area first renders, for a second
 *   "loaded" when the data changes later (the old sentence goes, silently, when the note it was
 *   made from changes), or for a recovery that never showed Loading.
 * - Put the status OUTSIDE the element marked `aria-busy`: a busy live region is not announced
 *   until it stops being busy.
 */
export function useLoadingNote(
  state: LoadingState,
  notes: LoadingNotes,
  load?: string | undefined,
): { status: string; alert: string } {
  const hydrating = useSyncExternalStore(
    noSubscription,
    () => false,
    () => true,
  );
  const lateMount = useRef<boolean | null>(null);
  if (lateMount.current === null) lateMount.current = !hydrating;
  const [held, setHeld] = useState(lateMount.current);
  useEffect(() => {
    if (!held) return;
    const timer = window.setTimeout(() => setHeld(false), LOADING_NOTE_LEAD_MS);
    return () => window.clearTimeout(timer);
  }, [held]);

  // Derived while rendering, so the arrival replaces the loading note in one step. `first` is true
  // while the load that was under way at the first render is still running and nobody has asked
  // for anything else.
  const [seen, setSeen] = useState({
    state,
    load,
    first: state === "loading",
    arrival: "",
    failure: "",
  });
  let current = seen;
  if (seen.state !== state || seen.load !== load) {
    const asked = seen.load !== load;
    current = {
      state,
      load,
      first: !asked && seen.first && state === "loading",
      arrival: state === "ready" && seen.state === "loading" && !seen.first ? notes.ready : "",
      failure: state === "error" ? (notes.error ?? "") : "",
    };
    setSeen(current);
  } else if (seen.arrival !== "" && seen.arrival !== notes.ready) {
    // What the sentence described has changed: it is dropped, silently, not kept for later.
    current = { ...seen, arrival: "" };
    setSeen(current);
  }
  if (held) return { status: "", alert: "" };
  return {
    status: state === "loading" ? (current.first ? "" : notes.loading) : current.arrival,
    alert: current.failure,
  };
}

/**
 * The status of a loading area, visually hidden, and, when it has an error note and a load has
 * failed, an alert. Render it next to the area, not inside the element that is `aria-busy`.
 *
 * The status is in the page from the first render and its text is written in. The alert is added
 * with its text: an `alert` role is spoken when it is inserted, which a status is not.
 */
export function LoadingNote({
  state,
  notes,
  load,
}: {
  state: LoadingState;
  notes: LoadingNotes;
  /** What is being loaded, when the area can be asked for something else (a tab, a filter). */
  load?: string | undefined;
}) {
  const { status, alert } = useLoadingNote(state, notes, load);
  return (
    <>
      <p role="status" className="sr-only">
        {status}
      </p>
      {alert !== "" && (
        <p role="alert" className="sr-only">
          {alert}
        </p>
      )}
    </>
  );
}

Props

PROPTYPEDEFAULTREQUIRED
variantenum
block | text
"block"no
width

Caller dimension applied via style on the block bar (string or number). It is clamped to the container: it can ask for less, never more.

string | number—no
height

Caller dimension applied via style on the block bar (string or number).

string | number—no
lines

Number of stacked bars in the text variant, rounded down with a minimum of 1. Non-finite values fall back to 3.

number3no
aria-label

Deprecated and not applied. A Skeleton used to be a status named "Loading" (or this label); it is decorative now. In development a structured error says so, once. Name the loading area instead. The same holds for aria-labelledby, aria-describedby, role, aria-live and aria-busy.

string—no
role

Deprecated and not applied: a Skeleton is decorative and has no role. See aria-label.

string—no

Text lines round down, with a minimum of one; non-finite counts become three. The last line is shortened.

A Skeleton used to be a status named "Loading". It is decorative now, and the naming props are deprecated and not applied: aria-label, aria-labelledby, aria-describedby, role, aria-live and aria-busy are still accepted, so existing code compiles and renders, but none reaches the element, and in development a structured PROP_NOT_APPLIED error says so once for each. Move the name to the loading area, as above. id, className, style and data-* pass through; aria-hidden is always "true".

Accessibility

  • Hidden from assistive technology (aria-hidden="true"): no role, no name, no text. It is not a live region, so any number of placeholders add nothing to what a screen reader says.
  • The area that loads is marked aria-busy. For a load someone asked for it has one polite status beside it that says Loading <what> and then that the content has arrived, and an alert for a failure; its first load, as the page comes up, is silent. See Announcing a loading area.
  • Pulses stop with reduced motion.
  • In forced-colors (high contrast) mode the bars are drawn in a system color, so a loading area is not an empty one.

Manifest entry

<section aria-labelledby="tracks-title">
  <h2 id="tracks-title">Tracks</h2>
  <p role="status" className="sr-only">{note}</p>
  <div aria-busy={loading}>
    {loading ? <Skeleton variant="text" lines={3} /> : <TrackList tracks={tracks} />}
  </div>
</section>
View agent manifest
{
  "description": "Loading placeholder, purely visual and silent: hidden from assistive technology, with no role, name or text, so a screen of placeholders does not say \"Loading\" once each. block renders one pulsing bar; text stacks `lines` bars with a shortened last line. Bars fill their container and never widen it, whatever width the caller asks for, and are drawn in a system color in forced-colors mode. The area that is loading says it: mark the area `aria-busy`, keep one polite status outside it (on the page before it has anything to say) that says \"Loading <what>\" and then that the content has arrived.",
  "props": {
    "variant": {
      "type": "enum",
      "values": [
        "block",
        "text"
      ],
      "default": "block"
    },
    "width": {
      "type": "union",
      "types": [
        "string",
        "number"
      ],
      "description": "Caller dimension applied via style on the block bar (string or number). It is clamped to the container: it can ask for less, never more."
    },
    "height": {
      "type": "union",
      "types": [
        "string",
        "number"
      ],
      "description": "Caller dimension applied via style on the block bar (string or number)."
    },
    "lines": {
      "type": "number",
      "default": 3,
      "description": "Number of stacked bars in the text variant, rounded down with a minimum of 1. Non-finite values fall back to 3."
    },
    "aria-label": {
      "type": "string",
      "description": "Deprecated and not applied. A Skeleton used to be a status named \"Loading\" (or this label); it is decorative now. In development a structured error says so, once. Name the loading area instead. The same holds for aria-labelledby, aria-describedby, role, aria-live and aria-busy."
    },
    "role": {
      "type": "string",
      "description": "Deprecated and not applied: a Skeleton is decorative and has no role. See aria-label."
    }
  },
  "composable_with": [
    "Card",
    "DataTable"
  ],
  "never_inside": [
    "Button",
    "Badge"
  ],
  "example": "<section aria-labelledby=\"tracks-title\">\n  <h2 id=\"tracks-title\">Tracks</h2>\n  <p role=\"status\" className=\"sr-only\">{note}</p>\n  <div aria-busy={loading}>\n    {loading ? <Skeleton variant=\"text\" lines={3} /> : <TrackList tracks={tracks} />}\n  </div>\n</section>"
}