UI Elements Lab · Newcomer → Expert
Frontend UI elements — interactive school
Learn the names, jobs, states, and “agent language” for the controls that make web apps feel real. Examples draw from your Map Builder when useful, but the catalog is wider than this repo.
See it, click it, learn its name.
Know variants, states, and when to use which.
Accessibility, design systems, precise agent prompts.
How to study
- Open each module. Play with every live demo.
- Read the Say to an agent box — copy those phrases later.
- Do the quiz. Mark progress in the sidebar (auto-saves in this browser).
- Finish with Mastery Challenge.
Catalog (what’s inside)
| Track | Modules |
|---|---|
| Foundations | Anatomy & states · Tokens & hierarchy |
| Actions | Buttons · Links vs buttons · Segmented & icon actions |
| Inputs | Text fields · Choice controls · Sliders · Files & colour |
| Feedback | Badges & chips · Progress & loading · Toasts & alerts |
| Containers | Tabs & accordion · Modal · Drawer · Tooltip & popover |
| Navigation | Nav patterns · Steps & pagination |
| Data & maps | Tables & toolbars · Map UI (repo-flavoured) |
| Expert | Accessibility · Design systems · Mastery |
Foundations · NEWCOMER
Anatomy & interactive states
Before names of widgets, learn the shared language of “how a control behaves.”
| Word | Meaning | Example |
|---|---|---|
| Affordance | Looks like you can use it | Raised button vs plain text |
| Hit target | Clickable/tappable area (aim ≥44×44px on touch) | Icon button padding |
| Focus ring | Outline for keyboard users | Tab into a field |
| Feedback | UI answers your action | Toast, spinner, colour change |
| Hierarchy | What looks most important | Primary vs ghost button |
State matrix (live)
Same button, different states — experts always specify which state they mean.
Foundations · FLUENT
Design tokens & visual hierarchy
Tokens are named design decisions. Hierarchy decides what the eye notices first.
Roles beat raw hex: say “use danger token” not “make it that red.”
:root {
--olive: #6b8e23; /* primary action */
--paper: #f6f5ef; /* page surface */
--ink: #23281f; /* body text */
--line: #e1dfcf; /* borders */
}
Hierarchy recipe
- One primary action per view region (e.g. Generate map)
- Secondary for safe alternatives (Cancel, Export CSV)
- Ghost/tertiary for low emphasis
- Danger only for destructive actions
Actions · NEWCOMER
Buttons
A button performs an action on this page. Master variants first — they are half of all UI talk.
| Variant | Job | Repo-ish example |
|---|---|---|
| Primary | Main thing to do | Generate map / Send to builder |
| Secondary | Alternative, safer | Export CSV, Cancel |
| Ghost / tertiary | Low emphasis | “Other input methods” |
| Danger | Destructive | Clear all pins |
| Icon button | Compact toolbar action | Save draft floppy, What's new bell |
| FAB | Floating dominant action (mobile) | Rare in your maps; common in mobile apps |
Actions · FLUENT
Links vs buttons
Newcomers mix these up. Experts almost never do.
Goes somewhere — new page, URL, download location, in-page anchor.
Does something here — open modal, generate map, toggle layer.
Actions · FLUENT
Segmented controls & toggle buttons
Pick one option from a small set — like Pest Control vs Public Cleansing on your start card.
Selected: pest
Inputs · NEWCOMER
Text fields & forms anatomy
Label + control + helper/error text. Experts never ship a placeholder-only field.
| Type | Use |
|---|---|
| text | General words (street, landmark) |
| search | Query boxes (LandsD location search) |
| number | RAR %, counts — still validate yourself |
| password | Secrets (inbox token page) |
| email / tel / url | Hints mobile keyboards |
| textarea | Feedback comment, remarks |
Inputs · NEWCOMER
Checkbox, radio, switch
Three cousins — wrong choice confuses users and agents.
| Control | Question it answers |
|---|---|
| Checkbox | “Which of these apply?” (0…many) |
| Radio | “Which one option?” (exactly one in a group) |
| Switch | “Is this setting on?” (immediate toggle) |
Inputs · FLUENT
Sliders, steppers & numeric entry
Sliders are great for approximate values; number fields for exact ones. Sometimes you offer both.
Inputs · FLUENT
File upload, dropzones & colour pickers
Your builder lives on CSV dropzones and colour swatches — learn the vocabulary.
Inputs · FLUENT
Select, listbox, combobox
Different words for “choose from a list” — precision matters at expert level.
| Term | Meaning |
|---|---|
| Select / dropdown | Native or custom single choice menu |
| Listbox | Visible list; often multi-select (RAR Phase listbox) |
| Combobox | Type-ahead + list (searchable select) |
| Menu | Actions list (not for choosing form data) |
| Autocomplete | Suggestions while typing (location search) |
Feedback · NEWCOMER
Badges, chips, tags, pills
Small labeled bits. Easy to confuse — here’s the split.
| Name | Job |
|---|---|
| Badge | Non-click status or count |
| Chip / pill / tag | Compact choice, filter, or removable item |
| Dot / status indicator | Tiny presence (unread red dot on bell) |
Feedback · FLUENT
Progress, spinners, skeletons
Waiting without feedback feels broken. Experts choose the right wait pattern.
Feedback · FLUENT
Toasts, alerts, banners, empty states
Different urgency → different furniture.
Add pins on the map or upload a CSV to begin.
| Pattern | When |
|---|---|
| Toast / snackbar | Brief confirmation; auto-dismiss |
| Inline error | Next to the field that failed |
| Alert / banner | Page-level notice that can wait |
| Modal error | Must acknowledge before continuing (use sparingly) |
| Empty state | No data yet — teach the first action |
Containers · NEWCOMER
Tabs, accordion, disclosure
Ways to show one chunk of content at a time without leaving the page.
Containers · FLUENT
Modal / dialog
A modal blocks the page until you finish a small task or dismiss it.
- Role dialog + aria-modal="true"
- Focus moves inside; Esc closes; restore focus to opener
- Backdrop click — decide yes/no deliberately
- Don’t stack five modals
Containers · FLUENT
Drawer, sheet, side panel
Slides in from an edge — good for filters or mobile menus without full-page navigation.
| Name | Typical use |
|---|---|
| Drawer | Left/right panel (nav or filters) |
| Bottom sheet | Mobile action panel from bottom |
| Sticky side panel | Your builder preview — not an overlay, stays in layout |
Containers · FLUENT
Tooltip vs popover vs popup
Three different “floating bits” — map apps use all three meanings.
| Term | Meaning |
|---|---|
| Tooltip | Short hint; no interactive content |
| Popover | Small floating panel; may contain controls |
| Dropdown menu | Action list in a popover |
| Map popup | Leaflet bindPopup — info card on a marker |
| Map tooltip | Leaflet bindTooltip — often permanent serial labels |
Navigation · FLUENT
Steppers, wizards & pagination
Steppers = ordered tasks. Pagination = slices of a long list.
Data · FLUENT
Tables, grids & toolbars
Spreadsheets in the browser — your picker table is a classic data grid cousin.
| Camera ID | Lat | Lng | |
|---|---|---|---|
| TP_001 | 22.450121 | 114.170334 | |
| TP_002 | 22.451002 | 114.168881 |
Data · EXPERT · repo-flavoured
Map-specific UI elements
Leaflet apps add their own control vocabulary on top of normal UI.
| Element | Language to use |
|---|---|
| Basemap layers control | Tile layer switcher; click-to-expand |
| Marker | Point symbol; divIcon / SVG glyph |
| Popup | Click card on marker |
| Tooltip / label | Permanent serial / RAR% label |
| Cluster / spiderfy | Group overlaps; explode on click |
| Legend | Key; swatches may be interactive |
| Measure toolbar | Dist/Area + annotation tools |
| Locate control | Geolocation / “my location” |
| Scale bar | Distance legend on map |
| Hash share state | URL encodes view/filters |
Expert · EXPERT
Accessibility (a11y) essentials
If you can name these, agents take you seriously — and users with keyboards/screen readers survive.
| Concept | What to say |
|---|---|
| Focus order | Tab moves in logical reading order |
| aria-label | Name for icon-only controls |
| aria-expanded | Disclosure / accordion open state |
| aria-pressed | Toggle button on/off |
| aria-live | Region that announces toasts/errors |
| Role | dialog, tablist, toolbar, menu… |
| Reduced motion | Respect prefers-reduced-motion |
Expert · EXPERT
Design systems & component language
A design system is a shared kit: tokens + components + rules. Your repo is a lightweight one.
| Phrase | Meaning |
|---|---|
| Component | Reusable UI unit (Button, Field, Toast) |
| Variant | Look option (primary/secondary) |
| Size | sm / md / lg density |
| Composition | How components combine into a screen |
| Density | Comfortable vs compact spacing |
| Responsive | Adapts to viewport (your 900px breakpoint) |
| Progressive disclosure | Hide advanced until needed |
| Optimistic UI | Show success before server confirms (advanced) |
| Design debt | Inconsistent one-off styles |
On [screen/file], change [component] to [variant/state]. Keep tokens [--olive…]. Mobile: [breakpoint behaviour]. A11y: [focus / aria]. Don’t alter [constraint].
Capstone · EXPERT
Mastery challenge
Score these scenarios. Each is how real product talk sounds.
Quick “I can explain…” checklist
Reference
UI glossary (A–Z)
Filter as you talk with agents.
- Accordion
- Stacked expand/collapse sections
- Affordance
- Cue that something is interactive
- Alert / banner
- Persistent page message
- Autocomplete
- Suggestions while typing
- Badge
- Status or count label
- Breadcrumb
- Hierarchy path links
- Breakpoint
- Width where layout changes
- Chip / pill / tag
- Compact filter or item
- Combobox
- Typeable select
- Dialog / modal
- Blocking overlay
- Disclosure
- Show/hide details control
- Drawer / sheet
- Edge-sliding panel
- Dropdown
- Collapsible menu or select
- Empty state
- UI when there’s no data
- FAB
- Floating action button
- Focus ring
- Keyboard highlight
- Ghost button
- Low-emphasis outlined/text button
- Hit target
- Clickable area size
- Icon button
- Action with icon, little/no text
- Legend
- Map key for symbols/colours
- Listbox
- Selectable list (often multi)
- Popover
- Floating panel with content
- Progress
- Determinate completion bar
- Radio group
- Choose exactly one
- Range / slider
- Pick value along a continuum
- Segmented control
- Compact mutually exclusive choices
- Skeleton
- Loading placeholder shapes
- Snackbar / toast
- Temporary feedback message
- Stepper
- Ordered wizard steps
- Switch
- Immediate on/off
- Tab
- Peer panel switcher
- Token
- Named design value
- Toolbar
- Cluster of actions
- Tooltip
- Short hover/focus hint
- Variant
- Style option of a component