Skip to content

SavingIndicator

A small word beside a title while something saves in the background: «Saving…», then «Saved at 14:02». Silent when idle.

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

On this page
  1. A name that saves itself
  2. When to use it
  3. For everyone
  4. Props

A name that saves itself

Write in the field and stop.

Code
import { useState } from 'react';
import { Input, SavingIndicator } from '@sypnia/ui/react';

// Beside a title that saves by itself. Write and stop.
export default function Title() {
  const [saving, setSaving] = useState(false);
  const [at, setAt] = useState<Date>();
  return (
    <div className="sy-row">
      <Input aria-label="Dashboard name" defaultValue="Sales by week" onChange={() => { setSaving(true); setTimeout(() => { setSaving(false); setAt(new Date()); }, 800); }} />
      <SavingIndicator saving={saving} savedAt={at} />
    </div>
  );
}

When to use it

Use it when

  • Titles and settings that save as they change.

Do not use it when

  • Editors with failures to show: use AutosaveStatus, which offers to try again.

For everyone

  • It is a status, read when it changes.

Props

SavingIndicatorTypeDefault
savingrequired boolean
savedAt string | number | Date
  1. A name that saves itself
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms