---
name: feedback-loop-states-and-latency
description: 'Use this skill when designing the visible states an interactive element passes through (idle / pending / success / error) and matching feedback timing to the user''s perceptual thresholds. Trigger when designing button states, form-submit flows, file-upload progress, loading screens, or any interaction whose response time is variable. Sub-aspect of `feedback-loop`; read that first.'
---
# Feedback states and latency thresholds
Most interactive actions pass through a small set of visible states; the system must communicate each. The latency of each state determines what feedback is appropriate — a 50ms response needs no spinner, a 5s response needs progress info, a 50s response needs estimated time remaining.
## The four states
### Idle
The element is interactive and waiting. Affordance signals "you can do this." Static styling.
### Pending
Action triggered; system working. Disable trigger to prevent re-submit; show indicator if wait > ~500ms.
### Success
Action succeeded. Show the result in-place where possible; toast/banner if the result is on another surface.
### Error
Action failed. In-context, specific, actionable error message.
```html
```
## Latency thresholds (Miller, Card et al., Doherty)
| Latency | Threshold | Pattern |
|---|---|---|
| < 100ms | "Instant" | No indicator. Just respond. |
| 100–400ms | "Responsive" | Light state change (button briefly disabled). |
| 400ms–1s | "Noticeable" | Spinner or progress micro-animation. |
| 1–10s | "Waiting" | Spinner with status text. |
| > 10s | "Long" | Progress bar with estimated time remaining; cancel option. |
**Doherty Threshold (~400ms)**: response times under this keep users in flow. Above this, attention drifts and engagement drops.
## Optimistic UI
For actions where the success rate is high and the action is reversible, update the UI as if the action succeeded immediately, then commit in the background. If the action fails, roll back visibly with an error message.
```js
async function toggleStar(item) {
// Optimistic
item.starred = !item.starred;
render();
try {
await api.updateStar(item.id, item.starred);
} catch (err) {
// Rollback with feedback
item.starred = !item.starred;
render();
showToast(`Couldn't update: ${err.message}`);
}
}
```
The user gets instant feedback; failure is the exception, handled with explicit feedback.
## Skeleton screens vs. spinners
For loading content (not actions), prefer **skeleton screens** to spinners:
```html
Uploading file.zip
42% — about 2 minutes remaining
We couldn't find an account with this email. Sign up?