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'
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
| SavingIndicator | Type | Default |
|---|---|---|
savingrequired | boolean | |
savedAt | string | number | Date |