算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
notifications-and-recovery【设计与创意】Toasts, inline errors, banners and recovery paths. Use when designing error states, success confirmations, async feedback or in-place editing.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
When something changes — success, failure, or anything in between — the user must know. And when something goes wrong, they must always have a path forward. A notification without a recovery action is just an apology.
| Pattern | When to use | Dismissal |
|---|---|---|
| Toast | Transient result of a user action (saved, sent, deleted) | Auto-dismiss 4–6s, manual close |
| Inline error | Field-level validation, form errors | Clears on correction |
| Alert banner | Persistent issue affecting the current context | Manual dismiss or resolved state |
| Modal / dialog | Blocking error requiring a decision before continuing | User action required |
| Empty state | No data yet — guide the user to the first action | Replaced by the first item |
| Skeleton / loading | Async content pending | Replaced by content |
| In-place confirmation | Inline edit saved, row updated, item toggled | Auto-clears after 2–3s |
Toasts confirm that a background action completed. They appear without interrupting the user's flow.
Placement: bottom-center or bottom-right. Never top-center — it competes with page content and navigation.
Duration: 4–6 seconds for information. Errors should persist until dismissed — the user needs time to read and act.
Anatomy:
[Icon] Message text [Action] [×]
✓ "Changes saved."
✓ "Message sent. [Undo]"
✗ "Could not save. Check your connection. [Retry]" ← persists until dismissed
Never: multiple simultaneous toasts. Queue them; show one at a time.
Inline errors appear adjacent to the element that caused them. They are the most contextual and actionable form of error feedback.
Form validation:
--color-erroraria-describedby for screen readers<label for="email">Email</label>
<input id="email" aria-describedby="email-error" aria-invalid="true">
<p id="email-error" role="alert">Enter a valid email address.</p>
In-place editing:
Banners are persistent — they stay until the condition is resolved or the user dismisses them.
Use for:
Placement: top of the affected section, not the entire page unless the issue is truly global.
Anatomy:
[Icon] [Message — describes the issue and its scope] [Action] [×]
Every error state must have a path forward. Design the recovery action at the same time as the error message.
For transient failures (network, timeout, rate limit):
"Could not load results."
[Try again]
For destructive or irreversible actions (delete, archive, send):
"Message sent. [Undo] ×"
For long-form inputs (forms, documents, editors):
When a feature fails but the rest of the product still works:
Loading is not an error, but it is a state that needs design.
Skeleton screens reduce perceived wait time compared to spinners. Match the skeleton shape to the actual content layout.
Toasts and banners are transient; a notification center is the persistent place a user goes to review and control what reaches them. Two things make it work.
Easy to reach, and easy to control. The user must get to their notification preferences with almost no digging (a bell icon → the center → settings). And keep the control model coarse — 1 to 3 categories at most, each with a simple level:
Off (0) — none of this categoryMinimal — only the important onesAll / granular — everythingDon't build a wall of per-event toggles. Two real needs dominate: silence everything, or keep one or two categories. Design straight for those — a prominent "mute all" / "mark all read" plus 1–3 category switches.
Minimise reading. The center is scanned, not read. Group by category, lead each item with a recognisable icon and the entity/action (not a paragraph), show unread state clearly, and let the whole list be cleared in one action. Reading is time (see [[ui-density]]) — a notification center that demands careful reading defeats its purpose.
role="alert" — announced immediately by screen readersrole="status" — announced politely (after current speech)pointer-events: none on the close buttonprefers-reduced-motion users may need more time to read)<!-- Error: immediate announcement -->
<div role="alert">Could not save. Check your connection.</div>
<!-- Status: polite announcement -->
<div role="status" aria-live="polite">Changes saved.</div>
aria-describedby?role="alert" and status updates via role="status"?