- 3 to 5 destinations only
- Icon plus a short label
- Clear active state
- Always visible, never scrolls away
UX patterns and how to apply them
Pick a UX pattern to try it live in a sample site. Then follow the steps, do and don’t lists, and copy the code to build it.
Nothing matches. Try another word or switch the filter back to All.
Home
Today: 2 tests left and a 5 day streak.
Mobile apps and mobile sites with a few equal-priority sections.
- List your top 3 to 5 tasks and give each one tab.
- Pick one icon and a one-word label per tab.
- Highlight the active tab with colour and a filled pill.
- Keep the order the same on every screen.
- Show a small badge for new items, never a long number.
- Tap accuracy on tabs
- Share of sessions that use 2+ tabs
- Keep labels to one word
- Make each target at least 44px
- Keep tab order fixed
- Add more than 5 tabs
- Use icons without labels
- Hide the bar while scrolling down
<nav class="tabs" aria-label="Main">
<button aria-current="page">Home</button>
<button>Practice</button>
</nav>
.tabs{position:fixed;bottom:0;display:flex}
.tabs button{flex:1;min-height:56px}
.tabs [aria-current]{background:var(--primary-soft)}Tap Menu. The drawer slides in, the page dims, and a tap outside closes it.
- Opens from a menu button
- Dims the page behind it
- Closes on outside tap or Esc
- Holds secondary links
Apps with many sections, admin tools and sites with long menus.
- Keep the top tasks outside the drawer.
- Put a clear Menu button in the top bar.
- Slide the drawer over the page and dim the rest.
- Close on scrim tap, Esc and after a link is chosen.
- Move focus into the drawer and return it when it closes.
- Drawer open rate
- Time to find a hidden item
- Group links with short headings
- Show where the user is now
- Trap focus while open
- Hide the main action only in the drawer
- Open it on hover
- Forget a visible close option
<button aria-expanded="false" aria-controls="dr">Menu</button>
<aside id="dr" hidden>...</aside>
btn.onclick=()=>{dr.hidden=false;btn.setAttribute("aria-expanded","true")}
addEventListener("keydown",e=>e.key==="Escape"&&close())No match. Try another word or clear the filter.
- Results update as you type
- Filter chips for common cuts
- Result count shown
- A clear no-match state
Course lists, tool libraries, shops, docs and any list of 10 or more items.
- Put the search box at the top, full width.
- Add 3 to 5 chips for the most common filters.
- Filter live and show the count of results.
- Add a clear button and a no-match message with a next step.
- Keep what the user typed when they go back.
- Search exit rate
- Zero-result rate
- Match partial words
- Show active filters as pressed chips
- Support / to focus the search
- Wait for Enter on small lists
- Show only "0 results"
- Reset filters on every visit
<input type="search" id="q" aria-label="Search">
<ul id="list">...</ul>
q.oninput=()=>{const v=q.value.toLowerCase();
items.forEach(li=>li.hidden=!li.textContent.toLowerCase().includes(v))}Your name
Pick your exam
All set
We will build a plan for your exam. You can change it any time.
- One topic per step
- Progress bar and step count
- Back and Next buttons
- Answers are kept
Sign-up, checkout, onboarding and applications with more than 5 fields.
- Group fields by topic and keep 1 to 3 per step.
- Show Step 1 of 3 and a progress bar.
- Put Next on the right and Back on the left.
- Save answers so Back never erases anything.
- End with a short review or success screen.
- Completion rate per step
- Drop-off step
- Ask the easy question first
- Use clear step titles
- Allow keyboard Enter to go next
- Hide how many steps remain
- Clear data on Back
- Ask for optional data early
<progress max="3" value="1"></progress>
<section data-step>...</section>
next.onclick=()=>{step++;show(step);bar.value=step}
back.onclick=()=>{step--;show(step);bar.value=step}- Message under the field
- Icon plus text, not colour only
- Submit enabled when valid
- Typed text is never lost
Sign-up, login, payment and any form with rules.
- Validate on blur first, then on every key after an error.
- Write the fix, not the rule: "Add @ and a domain".
- Show an icon and text for error and success.
- Disable submit until all fields are valid, with a reason nearby.
- Mark required fields with text, not only a star.
- Form error rate
- Time to complete
- Use aria-live for messages
- Keep messages short
- Show a strength hint for passwords
- Show errors before the user types
- Use red alone as the signal
- Clear the field after an error
<input id="e" aria-describedby="m">
<span id="m" role="status"></span>
e.oninput=()=>{const ok=/.+@.+\..+/.test(e.value);
m.textContent=ok?"Looks good":"Add @ and a domain";go.disabled=!ok}Saved decks
- Appears within 100ms
- Auto-hides after about 5s
- Undo restores the item
- Does not block the page
Delete, archive, save and copy actions that are easy to reverse.
- Run the action at once and show the toast.
- Say what happened: "Deck deleted".
- Add one Undo button inside the toast.
- Hide after 5 seconds and pause on hover.
- Announce it with role="status" for screen readers.
- Undo rate
- Support tickets about lost data
- Keep text under 6 words
- Pause the timer on hover
- Place it where the action happened
- Stack many toasts
- Use a toast for errors that need action
- Auto-hide without Undo for deletes
<div class="toast" role="status">Deck deleted <button>Undo</button></div>
let t;function toast(){el.classList.add("show");clearTimeout(t);
t=setTimeout(()=>el.classList.remove("show"),5000)}Today’s tests
- Shapes match the final layout
- Soft shimmer motion
- Replaced by real content
- No layout shift
Lists, cards, feeds and dashboards that load from a server.
- Draw the loaded layout first with the real sizes.
- Replace text and images with soft grey blocks.
- Add a slow shimmer, and turn it off for reduced motion.
- Swap in real content in the same place.
- Show an error state if loading fails after a few seconds.
- Perceived load time
- Layout shift score
- Match the real heights
- Use 3 to 6 blocks, not 30
- Respect prefers-reduced-motion
- Use a spinner on the full page
- Animate fast and flashy
- Show shapes that do not match
.sk{height:56px;border-radius:12px;
background:linear-gradient(90deg,#eee 25%,#fff 50%,#eee 75%);
background-size:200% 100%;animation:sh 1.2s infinite}
@keyframes sh{to{background-position:-200% 0}}
@media(prefers-reduced-motion:reduce){.sk{animation:none}}- 2 to 4 slides only
- One idea per slide
- Dots show progress
- Skip is always there
First launch of an app, a new feature or a big redesign.
- Decide the one result a new user should reach first.
- Write one slide per benefit, in 10 words or less.
- Add dots, Next and a visible Skip.
- End with one clear action, like Start a quiz.
- Never show it again after Skip or Done.
- Skip rate
- Time to first action
- Show value before asking for sign-up
- Use real screenshots or simple art
- Save the tour state
- Add more than 4 slides
- Hide Skip
- Explain every feature up front
<div class="slide">...</div>
<button id="skip">Skip</button><button id="next">Next</button>
next.onclick=()=>{i<last?show(++i):finish()}
skip.onclick=finish;function finish(){localStorage.seen=1}A 12 week course with live doubt sessions and weekly tests.
Mechanics, heat, optics, electricity and modern physics.
Rated 4.8 by 1,240 students.
- Path shown from Home
- Current page is not a link
- Tabs share one topic
- Arrow keys move between tabs
Course pages, docs, shops and deep sites with many levels.
- Show the path only when the site is 3 or more levels deep.
- Make every parent a link and the current page plain text.
- Use tabs for parts of one topic, not for separate pages.
- Keep tab names to one or two words.
- Support Left and Right arrow keys on tabs.
- Back-button use
- Tab click rate
- Mark the current tab clearly
- Keep the order stable
- Use role=tablist and aria-selected
- Use tabs for different topics
- Link the current crumb
- Hide tabs behind a scroll without a hint
<nav aria-label="Breadcrumb"><a href="/">Home</a> / <b aria-current="page">Physics</b></nav>
<div role="tablist"><button role="tab" aria-selected="true">Overview</button></div>
<div role="tabpanel">...</div>- Few items per view
- Page numbers or Load more
- Scroll position is kept
- Total is visible
Course lists, results, history and any list of 20 or more items.
- Pick pages when users compare and return to items.
- Pick Load more when users just browse.
- Show 10 to 20 items at a time.
- Keep the position when the user goes back.
- Show how many items remain.
- Items viewed per session
- Back-navigation success
- Make page buttons 44px
- Show the current page clearly
- Add a keyboard-friendly Load more
- Use endless scroll with a footer below it
- Reset to page 1 on Back
- Load all items at once
<button id="more">Load 3 more</button>
more.onclick=()=>{shown+=3;
items.forEach((li,i)=>li.hidden=i>=shown);
if(shown>=items.length)more.hidden=true}Your progress
120 questions solved and a 5 day streak.
Reset all progress?
This clears your streak and scores. It cannot be undone.
- Dims the page behind it
- Names the action clearly
- Cancel is easy and safe
- Esc closes it
Account delete, reset, payment and anything permanent.
- Use it only for actions that cannot be undone.
- Title it as the exact action, like Reset all progress.
- Explain the result in one sentence.
- Use verb buttons: Cancel and Reset, not No and Yes.
- Focus Cancel first, close on Esc and return focus.
- Cancel rate
- Accidental action reports
- Use a red button for destructive actions
- Trap focus inside
- Use the dialog element
- Ask for every small action
- Write Are you sure only
- Use a modal for plain info
<dialog id="d"><h2>Reset progress?</h2>
<button>Cancel</button><button>Reset</button></dialog>
open.onclick=()=>d.showModal()No notes yet
Notes you save will show up here.
- An icon and one sentence
- One clear action
- Different text per case
- Never a blank area
First use, search with no match, offline and failed loads.
- List the empty cases: first use, no match, error.
- Write one calm sentence for each.
- Add one button that fixes it.
- Use a simple icon, not a big illustration.
- Keep the layout steady so nothing jumps.
- Action click rate
- Retry success
- Say why it is empty
- Offer the action in the same place
- Keep the tone friendly
- Show a blank page
- Blame the user
- Offer three buttons at once
<div class="state"><svg>...</svg>
<h3>No notes yet</h3>
<p>Notes you save will show up here.</p>
<button>Add a note</button></div>Yes. Lessons and 3 tests a day are free.
CUET, JEE, NEET, SSC and Banking.
Yes. It works in any browser, no app needed.
- Question or title first
- One tap to open
- One open at a time
- Arrow icon turns
FAQs, settings, long forms and pricing details.
- Decide what everyone needs and show it open.
- Put extra details behind clear titles.
- Use a button with aria-expanded for each title.
- Rotate the arrow when open.
- Keep each answer to a few lines.
- Open rate per item
- Support tickets on the topic
- Make the whole title row tappable
- Allow keyboard Enter and Space
- Open the first item
- Hide key info inside
- Nest more than 2 levels
- Use a link that looks like a title
<button aria-expanded="false" aria-controls="a1">Is it free?</button>
<div id="a1" hidden>Yes.</div>
b.onclick=()=>{const o=b.getAttribute("aria-expanded")==="true";
b.setAttribute("aria-expanded",!o);a1.hidden=o}Daily goal
0 of 5Solve 5 questions to keep your streak.
- A small daily goal
- Progress updates at once
- Streak shown with dots
- Praise on completion
Learning apps, fitness, habit trackers and onboarding checklists.
- Set one goal that takes 5 to 10 minutes.
- Show progress as a bar and a number.
- Update it the moment the user acts.
- Show the streak and what keeps it alive.
- Celebrate once, quietly, then stop.
- Day 7 return rate
- Goal completion rate
- Let people pause a streak
- Use calm praise
- Show the next step
- Shame a missed day
- Use many pop-ups
- Set a goal that is too big
<progress id="p" max="5" value="0"></progress>
done.onclick=()=>{p.value++;
label.textContent=p.value+" of 5";
if(p.value==5)msg.textContent="Goal done!"}Mock tests felt like the real exam.5 star
Clear notes. I want more video.4 star
My rank went up in a month.5 star
- Rating and count together
- Real names and short quotes
- Filter by stars
- Fresh and honest
Landing pages, course pages, pricing and checkout.
- Show the rating and how many people gave it.
- Add 2 or 3 short, real reviews.
- Let people filter by stars.
- Place proof near the main button.
- Update it often and show the date.
- Conversion rate
- Scroll depth to reviews
- Use real names with permission
- Show mixed reviews too
- Link to the source
- Invent reviews or numbers
- Show only 5 star quotes
- Hide the count
<div class="score"><b>4.8</b> <small>from 1,240 reviews</small></div>
chips.onclick=e=>items.forEach(li=>li.hidden=
e.target.dataset.f&&li.dataset.f!==e.target.dataset.f)Preferences
Changes apply at once and are saved for next time.
- Switches, not menus
- Applies at once
- Saved for next time
- Few and clear options
Settings screens, reading apps and tools used for long sessions.
- Offer only choices that matter: theme and text size.
- Use a switch for on or off options.
- Apply the change before the user leaves the screen.
- Save it with localStorage.
- Do not follow the phone setting if you promise fixed themes.
- Opt-in rate
- Session length by theme
- Label each switch
- Show the result live
- Keep defaults sensible
- Hide settings deep in menus
- Need a Save button for a switch
- Reset options after a reload
<button role="switch" aria-checked="false" id="dk"></button>
dk.onclick=()=>{const on=dk.getAttribute("aria-checked")!=="true";
dk.setAttribute("aria-checked",on);
document.documentElement.dataset.theme=on?"dark":"light";
localStorage.theme=on?"dark":"light"}Dashboard
Pick a section on the left. Use Collapse to save space; icons stay and labels show as tooltips.
- Fixed on desktop
- Icon plus label
- Collapses to icons
- Active item highlighted
Dashboards, admin tools, docs and apps with 5 to 10 sections.
- Group 5 to 8 links by task and put the most used first.
- Give each link an icon and a short label.
- Highlight the current page with colour and aria-current.
- Add a Collapse button and show labels as tooltips when collapsed.
- Switch to a bottom bar or drawer on phones.
- Clicks to reach a page
- Collapse rate
- Keep the order the same on every page
- Remember the collapsed state
- Make rows at least 44px
- Add more than 10 top links
- Use icons with no label or tooltip
- Show it open on small phones
<aside class="side"><button aria-current="page">Dashboard</button></aside>
.side{width:200px}
.side.col{width:68px}
.side.col span{display:none}
collapse.onclick=()=>side.classList.toggle("col")No command found.
- Opens with Ctrl or Cmd + K
- Filters as you type
- Shows shortcuts
- Works with arrow keys
Tools with many actions, editors, dashboards and power users.
- List the 10 to 20 most used actions with plain names.
- Open it with Ctrl or Cmd + K and a visible button.
- Filter by typed letters in any order.
- Show the shortcut at the right of each action.
- Move with arrows, run with Enter, close with Esc.
- Palette use per session
- Time to run an action
- Rank recent actions first
- Show a no-match message
- Keep names verbs: Open, Start
- Hide it with no hint
- Need the exact command name
- Run risky actions with no confirm
<input id="q" aria-label="Command">
q.oninput=()=>cmds.forEach(b=>b.hidden=
!b.textContent.toLowerCase().includes(q.value.toLowerCase()))
addEventListener("keydown",e=>(e.ctrlKey||e.metaKey)&&e.key==="k"&&q.focus())- Suggestions under the field
- Filters by typed letters
- Click or Enter to pick
- Works with keyboard
Pick lists with more than 10 options: exam, city, college, country.
- Use it when the list has more than 10 options.
- Show suggestions after the first letter.
- Highlight the typed part in each option.
- Let arrows and Enter pick, and Esc close.
- Add role=combobox and aria-expanded.
- Time to pick
- Typing errors
- Match from any part of the word
- Show a no-match line
- Keep the typed text if closed
- Use a plain select for 100 options
- Require exact spelling
- Hide the list before a click lands
<input role="combobox" aria-expanded="false" aria-controls="lb">
<ul id="lb" role="listbox" hidden>...</ul>
inp.oninput=()=>{opts.forEach(o=>o.hidden=
!o.textContent.toLowerCase().includes(inp.value.toLowerCase()))}Notifications
3- Bell with count badge
- Unread items stand out
- Click marks as read
- Mark all read
Learning apps, dashboards, social and any app with updates.
- Show only useful updates, not every event.
- Put a count badge on the bell and cap it at 9+.
- Style unread items and keep read ones calm.
- Mark one as read on click and offer Mark all read.
- Link each item to the thing it is about.
- Open rate
- Mute or opt-out rate
- Group by day
- Let users choose types
- Announce new items politely
- Notify about everything
- Keep the badge after reading
- Use sound by default
<button aria-label="3 unread">Bell <b id="n">3</b></button>
item.onclick=()=>{item.classList.remove("un");
n.textContent=document.querySelectorAll(".un").length}| Riya | 92 |
| Aman | 78 |
| Sara | 85 |
| Kabir | 69 |
- Click a header to sort
- Arrow shows direction
- Numbers aligned
- Scrolls inside its box
Ranks, results, prices, reports and admin lists.
- Keep columns to 3 to 6 and name them clearly.
- Make each header a button with aria-sort.
- Sort ascending first, then descending.
- Show an arrow for the current sort.
- Let the table scroll sideways inside its own box on phones.
- Sort use
- Time to find a row
- Align numbers right or left, not mixed
- Keep the header visible
- Use a real table element
- Build it from divs
- Sort without showing direction
- Let the page scroll sideways
<th aria-sort="none"><button data-k="s">Score</button></th>
btn.onclick=()=>{dir=-dir;rows.sort((a,b)=>(a.dataset.s-b.dataset.s)*dir)
rows.forEach(r=>tbody.append(r));th.setAttribute("aria-sort",dir>0?"ascending":"descending")}- One slide at a time
- Prev and Next buttons
- Dots show position
- No auto-play
Featured courses, product photos, testimonials and tips.
- Use 3 to 6 slides and put the best one first.
- Add Prev and Next buttons at least 44px.
- Show dots so people know where they are.
- Do not auto-advance. If you must, add Pause.
- Keep content readable without moving.
- Click rate by slide
- Slide 1 share of clicks
- Support swipe and arrow keys
- Announce the slide with aria-live
- Loop only if it helps
- Auto-play fast
- Hide important info after slide 1
- Use tiny arrows
<div aria-roledescription="carousel">
<div class="slide">...</div></div>
next.onclick=()=>show((i+1)%slides.length)
prev.onclick=()=>show((i-1+slides.length)%slides.length)Timed tests that copy the real exam. Results show in 1 minute.
Hover or focus the first button for a tooltip. Click the second to open a popover. Esc closes it.
- Tooltip on hover and focus
- Popover on click
- Esc closes
- Short text only
Icon buttons, short definitions, hints and extra details.
- Use a tooltip for a label or short hint, under 8 words.
- Show it on hover and on keyboard focus.
- Link it with aria-describedby.
- Use a popover for more text, with a button to open it.
- Close the popover on Esc and outside click.
- Help clicks
- Support questions on the topic
- Place it so it never covers the control
- Keep the same delay everywhere
- Use plain words
- Hide key info only in tooltips
- Use hover only
- Put links inside a tooltip
<button aria-describedby="t">Streak ?</button>
<span id="t" role="tooltip">Days in a row</span>
.tipw:hover .tt,.tipw:focus-within .tt{opacity:1}Courses
24 results
- Slides up from the bottom
- Dims the page
- Easy to close
- Thumb-friendly
Filters, share, pick a date or option on mobile.
- Use it for a short task, not a long form.
- Open it from a clear button like Filters.
- Dim the page and slide the sheet over it.
- Put the main action at the bottom.
- Close on outside tap, Esc and the main action.
- Completion rate
- Close without action
- Keep it under 60% of the screen
- Add a visible close way
- Trap focus inside
- Use it on desktop for big forms
- Stack sheets
- Hide the close option
<div class="sheet" role="dialog">...</div>
.sheet{position:fixed;bottom:0;transform:translateY(105%);transition:transform .3s}
.open .sheet{transform:none}Each preview is a sample site built only to show the pattern. Test every pattern with real users and on a real phone.