Users Database (CRUD)
UI Coding
Medium
40 min
forms
state
crud
accessibility
keyboard
Build a small users database UI: a searchable list of people, a form with First name and Last name fields, and four actions: Create, Update, Delete and Cancel. Everything lives in memory. There's no backend.
The starter has the sample users, the layout and the buttons, but nothing is wired up.
Requirements
- List: show every user as
Last, First, sorted by last name, then first name. - Search: a Search field filters the list, case-insensitively, by any part of the full name. If the selected user is filtered out, the selection is cleared.
- Select: clicking a user selects them and copies their names into the form.
- Create: adds a new user from the form. Names are trimmed. It's only available when no user is selected and both trimmed fields are non-empty. Afterwards, clear the form.
- Update: saves the form into the selected user. It's only available when a user is selected, both fields are non-empty, and something actually changed.
- Delete: removes the selected user. It's only available when a user is selected. Afterwards, clear the selection and the form.
- Cancel: clears the selection and the form.
- Accessibility:
- The list follows the WAI-ARIA listbox pattern:
role="listbox"withrole="option"items,aria-selected, and a single tab stop. <kbd>↑</kbd>/<kbd>↓</kbd>/<kbd>Home</kbd>/<kbd>End</kbd> move the selection, and selection follows focus. - Inputs have visible labels.
- Each action is announced politely, for example
Created Lovelace, AdaorDeleted Turing, Alan. - After Delete, focus moves to the list instead of being lost on a now-disabled button.
- The list follows the WAI-ARIA listbox pattern:
Follow-up
- Persist to a REST API. What changes about state, loading and errors? Would you update optimistically?
- The list grows to 50,000 users. What breaks first?
- Add an "unsaved changes" guard when switching users with a dirty form.
Spotted a mistake or a rights concern? Report an issue