Skip to content

Motion

Things light up or fade; they never fly in. Four durations and three curves, and one loop: the shimmer of a skeleton.

import '@sypnia/ui/css'

On this page
  1. The durations
  2. The one loop
  3. When to use it
  4. For everyone

The durations

Press «Play». Anything can enter with data-enter: it fades in and travels at most var(--shift).

--dur-0

Presses

--dur-1

Hover and colour

--dur-2

Entering

--dur-3

Large surfaces

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

// Things light up or fade; they travel at most var(--shift). Press «Play» to see each duration.
const durations = [['--dur-0', 'Presses'], ['--dur-1', 'Hover and colour'], ['--dur-2', 'Entering'], ['--dur-3', 'Large surfaces']];
export default function Durations() {
  const [run, setRun] = useState(0);
  return (
    <div className="sy-stack" style={{ '--gap': 'var(--s-4)' } as React.CSSProperties}>
      <div><Button icon="play" onClick={() => setRun((n) => n + 1)}>Play</Button></div>
      <div className="sy-grid" style={{ '--min': '10rem', '--gap': 'var(--s-3)' } as React.CSSProperties}>
        {durations.map(([d, what]) => (
          <div key={`${d}-${run}`} data-enter="" className="sy-panel" style={{ animationDuration: `var(${d})`, padding: 'var(--s-4)' }}>
            <code>{d}</code><p className="sy-text--xs sy-text--muted">{what}</p>
          </div>
        ))}
      </div>
    </div>
  );
}

The one loop

Skeletons shimmer while data is on its way. Loops read var(--loop), so reduced motion stops them all at once.

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

// The shimmer: the one animation that loops. With reduced motion it stops, and the shape stays.
export default function Loading() {
  return (
    <div className="sy-row sy-row--nowrap" style={{ '--gap': 'var(--s-4)', alignItems: 'flex-start', maxWidth: '28rem' } as React.CSSProperties} aria-busy="true">
      <Skeleton circle height={44} />
      <div style={{ flex: 1 }}><SkeletonText lines={3} /></div>
    </div>
  );
}

When to use it

Use it when

  • --dur-* and --ease-* for every transition and animation.

Do not use it when

  • Spinners, bounces and things that slide across the screen.
  • A duration written by hand.

For everyone

  • With reduced motion every animation and transition becomes instant, and loops stop.
  1. The durations
  2. The one loop
  3. When to use it
  4. For everyone

    Search pages, sections and terms