Skip to content

SkeletonText

Grey lines that hold the place of a paragraph while it loads.

import { SkeletonText } from '@sypnia/ui/react'

On this page
  1. Three and five lines
  2. A paragraph that loads
  3. When to use it
  4. For everyone
  5. Props

Three and five lines

The last line is shorter, like the end of a paragraph.

Code
import { SkeletonText } from '@sypnia/ui/react';

// The last line is shorter, like the end of a paragraph.
export default function Lines() {
  return (
    <div className="sy-cols sy-cols--stack" aria-busy="true">
      <SkeletonText />
      <SkeletonText lines={5} />
    </div>
  );
}

A paragraph that loads

Press «Load again».

About this project

Orders, customers and products of the online store. The mobile app and the back office both read from here. Backups run every night and are kept for 7 days.

Code
import { useState } from 'react';
import { Button, Panel, SkeletonText } from '@sypnia/ui/react';

// Press «Load again».
export default function Loading() {
  const [loading, setLoading] = useState(false);
  const reload = () => { setLoading(true); setTimeout(() => setLoading(false), 2000); };
  return (
    <Panel title="About this project" actions={<Button size="sm" disabled={loading} onClick={reload}>Load again</Button>}>
      <div aria-busy={loading} aria-live="polite">
        {loading ? <SkeletonText lines={3} /> : (
          <p className="sy-text--sm sy-text--soft">
            Orders, customers and products of the online store. The mobile app and the back office both read from here.
            Backups run every night and are kept for 7 days.
          </p>
        )}
      </div>
    </Panel>
  );
}

When to use it

Use it when

  • A block of text is loading: a description, a message, an article.
  • Choose lines close to the real length, so the page does not jump when the text arrives.

Do not use it when

  • The content has a shape of its own (rows, cards, avatars): build it with Skeleton.
  • It is one short value: a single Skeleton with a width.

For everyone

  • It is hidden from screen readers. Mark the region with aria-busy="true" and aria-live="polite", as in the second example.
  • The shimmer stops under reduced motion.

Props

SkeletonTextTypeDefault
lines number 3
  1. Three and five lines
  2. A paragraph that loads
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms