Feedback & States — UI/UX

Design six states, not just success: loading, empty, error, success, partial (the five basic states), plus offline. Nielsen's limits: 0.1 second feels…

Your WhatsApp message starts with a little clock, then one tick, two ticks, and finally two blue ticks. You don't need to ask your friend whether it arrived. The screen already told you.

Those WhatsApp signs are feedback: the way a page tells people what is happening at every moment, such as loading, empty, failed or done. Each possible shape the page can be in is called a state. It's the same away from screens. Think of ordering at a food stall. You say "one fried rice", and the cook answers "sure, coming up". You see the wok start smoking, then the plate arrives. If there is no rice left, she says "sorry, no rice left, fried noodles instead?". If she says nothing after you order, you don't know whether you were heard, so you order a second time. The cook's "sure" and the smoking wok are feedback while you wait. A cook who says nothing is like a page with no feedback: the guest presses the book button twice.

Six states to design

Designers often draw only the page that worked and is full of data. Yet every part of a page has five basic states, plus one state for the connection. Here they all are, on the Mist Homestay booking page:

State When On Mrs. Sri's page
Loading waiting for data or an answer room list: a skeleton; the Book button: "Booking..."
Empty there really is no data "No rooms free on 12 Dec." with a "See 13 Dec" button
Error the request failed "Booking not sent yet. Try again." The nights choice stays as it was
Success the request worked "Booking sent. Mrs. Sri will confirm on WhatsApp."
Partial part of it worked the room photo failed to load, but the price and the Book button still work
Offline no connection "You're offline. Your booking hasn't been sent yet."

The first five states (empty, loading, error, success, partial) must be designed for every element that loads data. Offline is a special error that deserves its own message, because its cause and its way out are different: not "try again", but "connect to the internet first".

A good message says what happened and what to do next. "Error 500" (an error code from the server) helps nobody. "Booking not sent yet. Try again." helps, especially with a "Try again" button beside it.

How long the wait, which indicator

Jakob Nielsen, a usability researcher (Usability Engineering, 1993), gave three time limits that are still used today:

From those three limits, Nielsen Norman Group (NN/g, Katie Sherwin, 2014) recommends these indicators (signs that the page is working):

Wait Indicator
under 1 second no indicator needed
2 to 10 seconds a looped animation: a spinner or a skeleton
over 10 seconds a progress bar showing percent done

For 2 to 10 seconds, the choice depends on what is loading (NN/g, Samhita Tankala, 2023):

The Book button while it waits

Mr. Hadi presses "Book the room, pay on arrival". The button only turns grey, with no text change, and 3 seconds later "Booking sent" appears. The page works, and the booking arrives. But something is wrong. Guess what, before you look at the fixed button code below.

<button class="book" id="book">Book the room, pay on arrival</button>
<p id="status" role="status"></p>
<p id="error" class="error" role="alert"></p>

<script>
  const book = document.querySelector('#book');
  book.addEventListener('click', async () => {
    if (book.getAttribute('aria-disabled') === 'true') return; // don't book twice
    book.setAttribute('aria-disabled', 'true');
    book.textContent = 'Booking...';
    try {
      await sendBooking(); // fetch to Mrs. Sri's server
      document.querySelector('#status').textContent = 'Booking sent. Mrs. Sri will confirm on WhatsApp.';
    } catch {
      document.querySelector('#error').textContent = 'Booking not sent yet. Try again.';
    } finally {
      book.setAttribute('aria-disabled', 'false');
      book.textContent = 'Book the room, pay on arrival';
    }
  });
</script>

So the answer to the guess: there's no loading feedback. A grey button with no label change could mean "processing", or it could mean "this button is off". Mr. Hadi can't tell whether his tap registered, and 3 seconds is in the range that needs an indicator.

aria-live: news that gets read out

Screen reader users don't see "Booking sent" appear. A live region (a part of the page that screen readers watch) makes text changes inside it read out automatically. WCAG 4.1.3 (Status Messages, level AA) requires that status messages such as "Booking sent" are read out too. There are two kinds of live region:

Put the live region in the page, empty, from the moment the page loads. Then fill in its text when there's news. Screen readers watch regions that already exist. A region added together with its text is often not read out.

For a field with a wrong value, the error message also uses role="alert", plus two attributes on the field:

<label for="phone">Phone number</label>
<input id="phone" class="input-error" aria-invalid="true" aria-describedby="phone-error">
<span id="phone-error" class="error-msg" role="alert">A phone number must start with 08.</span>

<style>
  .input-error { border: 1px solid #EF4444; }  /* 3.76:1, enough for a line (3:1 minimum) */
  .error-msg { color: #b91c1c; }               /* 6.47:1, enough for text (4.5:1 minimum) */
</style>

⚠️ When the page just goes quiet

TL;DR: Design six states, not just success: loading, empty, error, success, partial (the five basic states), plus offline. Nielsen's limits: 0.1 second feels instant, 1 second keeps the flow of thought, 10 seconds is the limit of attention. Over 1 second, show an indicator. For 2 to 10 seconds, use a spinner (a spinning circle) or a skeleton (grey boxes the size of the content to come). Over 10 seconds, use a progress bar (a bar that shows the percent done). A skeleton screen is better for loading a page or a list, a spinner for one action. A waiting button changes its label ("Booking...") and uses aria-disabled (a mark that the button can't be used for now), not disabled, which throws keyboard focus away. So that screen readers read them out, success news goes in an element with role="status", and errors in one with role="alert" (WCAG 4.1.3). The element for those messages (the region) must already be there when the page loads. A field with a wrong value: aria-invalid="true", aria-describedby pointing at its message's id, border-color: #EF4444, and message text in #b91c1c.

⚡ Design five states, not just success

Meaning: A state is each possible shape a page can be in. Every element that loads data has five basic states: empty, loading, error, success (it worked), partial (part of it worked). Offline (no connection) gets a message of its own, because its way out is different: connect to the internet first. A good message says what happened and what to do next: "Booking not sent yet. Try again."

⚡ Skeleton or spinner

Meaning: Under 1 second, no indicator (a sign that the page is working) is needed. 2 to 10 seconds: a looped animation. Over 10 seconds: a progress bar (a bar that shows the percent done). For loading a whole page or list, a skeleton screen (grey boxes the size of the content to come) is better, because the content arrives in the same place with no jumping. A spinner (a spinning circle) is for one small action.

⚡ A waiting button has to say so

Write:

book.setAttribute('aria-disabled', 'true');
book.textContent = 'Booking...';
Guess first: Mr. Hadi presses the book button, it only turns grey, and 3 seconds later "Booking sent" appears. The booking arrives. What's wrong?

There's no feedback (no sign from the page) while it loads. A grey button with no new label could mean "processing", or it could mean "this button is off".

Meaning: book is the Book button. While it waits, change its label, and use aria-disabled (a mark that the button can't be used for now), not disabled, which throws keyboard focus away. So that screen readers read them out, success news goes into an element with role="status", and errors into one with role="alert". The element for those messages (a live region, a part of the page that screen readers watch) must already be there when the page loads.

What you will learn