Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names

A tour of the building blocks almost every app is made of: buttons, badges, inputs, selects, cards, tables, tabs, navigation, dialogs, drawers, toasts and empty states, with their states and their shadcn/ui names.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Fundamentals

What you will learn

  • Name the common UI elements and the job each one does
  • Check the states of an element: hover, focus, error, disabled, loading and empty
  • Choose between tabs and navigation, and between a dialog and a drawer
  • Ask AI for the exact shadcn/ui component by name

Before you start

  • Basic HTML and CSS

Almost every app is built from the same dozen pieces. A button, a field, a card, a table, a dialog, a little message in the corner. When you know these pieces by name, two things get easier: you can judge a screen quickly, and you can ask AI for exactly the element you want.

For each element below you get what it is for, which states it can be in, and which shadcn/ui component builds it. Every element in the pictures is rendered from a small gallery page in the project files, index.html with gallery.css.

Buttons and badges

Button variants Save in dark navy, Cancel in light grey, Export with an outline, Delete in red and a plain Skip. Below, the states Default, Hover, Disabled greyed out and Saving with a spinner. Below that, five badges: Active, Pending, Overdue, Draft and New.
Five button variants, four states and five status badges.

A button is the thing you click to do something. There are five variants. Default is the main action, like Save. Secondary and outline are quieter. Destructive is red, for Delete. Ghost is almost invisible, for small actions like Skip. Then the states: normal, hover, disabled and loading.

A badge is a tiny label that shows a status: Active, Pending, Overdue, Draft, New. The colour tells you the meaning before you even read the word.

Keep one primary button per screen. And when a button is disabled or loading, the user knows the click was understood.

Inputs and selects

Every form is made of these two. An input is where you type a value. Here is the gallery markup for its four states:

<div class="col" style="gap:1em">
  <div class="field"><label>Email</label><div class="input ph">[email protected]</div></div>
  <div class="field"><label>Email, focused</label><div class="input focus">emma@exam</div></div>
  <div class="field"><label>Email, with an error</label><div class="input err">emma@</div><div class="help err">Enter a valid email address.</div></div>
  <div class="field"><label>Email, disabled</label><div class="input dis">[email protected]</div></div>
</div>
Four email fields with labels: a normal empty field, a focused field with a blue ring, a field with a red border and the message Enter a valid email address, and a greyed-out disabled field.
Normal, focused, error and disabled. The label stays above the field in every state.

Focused has a blue ring, so you know where you are typing. Error is red, with a message that says exactly how to fix it. Disabled is greyed out, because you cannot change it right now. And the label above it always stays. A field without a label is a guess.

A select is for picking one value from a short list. In the gallery the priority is Medium, and the open menu shows Low, Medium, High and Urgent with a tick on the current one.

Every field needs a label, a focus ring and an error message that helps.

Cards and tables

A Weekly orders card with the big number 1,284, a green +12% badge and View report and Share buttons. Below, an orders table with columns Order, Customer, Status and Total, status badges in the rows, right-aligned totals and one highlighted row.
A card holds one idea. A table holds many rows to compare.

A card groups one idea. This one has a title, a short description, a big number, a badge and two buttons. Weekly orders, 1,284, up 12%. You look at it for one second and you get the point.

A table is for many rows that you want to compare: order, customer, status and total. Notice the badges inside the status column and the totals aligned to the right, so the numbers line up. One row is highlighted, because the mouse is over it.

Tabs and navigation

They look alike but do different jobs. Tabs switch the view inside the same page: Overview, Orders, Settings. Click one and only the panel below changes.

Navigation moves you to a different page. The gallery has a top bar with the logo, the links and the active link underlined, a breadcrumb that shows where you are, and a sidebar for apps with many sections.

The rule: tabs stay inside a page, navigation goes to another page.

Dialogs and drawers

Two elements that appear on top of the page. A dialog darkens the page behind it and asks a short question: "Delete this task?", Cancel or Delete. The user must answer before doing anything else, so use it only when a decision really matters.

A drawer, which shadcn/ui calls a sheet, slides in from the side and holds a longer form. In the gallery it edits a student, with a name, an email and a Save button. The page stays visible behind it, so the user keeps the context.

A dialog asks a short question. A drawer holds a longer form without leaving the page.

Toasts and empty states

A success toast Order saved, Order #1042 is now paid, with an Undo button, and an error toast Could not save, Check your connection and try again, with a Retry button. Below, an empty state with a plus icon, No tasks yet, Create your first task to get started, and a New task button.
A toast confirms what just happened. An empty state says what to do next.

A toast is a quick message in the corner after an action. Order saved, with Undo. Could not save, with Retry. Success is green, a problem is red, and after a few seconds the toast fades away by itself. In shadcn/ui this one is called Sonner.

An empty state is what you see when there is nothing to show yet: an icon, a clear message and one button that says what to do next. Without it, the user sees a blank page and wonders if something broke.

Element, job and component

ElementIts jobshadcn/ui
Button, BadgeAct, and show a statusButton, Badge
Input, SelectCollect a valueInput, Label, Select
Card, TableGroup and compareCard, Table
Tabs, NavigationSwitch view, change pageTabs, Sidebar
Dialog, DrawerAsk, or edit on the sideDialog, Sheet
Toast, Empty stateConfirm, and guideSonner, Empty

Use the names in the right-hand column when you ask AI. The project's PROMPT.md ends with this one:

Rewrite these elements using shadcn/ui components in a React and Tailwind project: Button, Badge, Input, Label, Select, Card, Table, Tabs, Dialog, Sheet, Sonner and Navigation Menu.

If you want to see how those components land in a real project, read shadcn/ui: components you own.

Common mistakes

  • Only designing the happy state. Check the error, disabled, loading and empty states too. States and feedback goes further on this.
  • A dialog for everything. A dialog blocks the page. If it is not a real decision, use a toast or a drawer.
  • Tabs that change the URL and page. That is navigation. Users expect tabs to keep them on the same page.
  • Dropping the label. A field without a label is a guess. Keep the label above it in every state.

Recap

Pick by job: act, collect, group, ask, confirm. Check every state: hover, focus, error, disabled, empty. Use the right name, the shadcn/ui component, in your AI prompts. These are the foundations of almost every app, and with them AI can generate the rest.

Keep going in React · 24 of 59

Previous
Typography That Sells: Type Scale, Line Length and Free Font Pairings
Next post
Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

Semantic HTML: header, nav, main, aside and footer as Page Landmarks

The same page written as div soup and with semantic tags looks identical, but only one gives screen readers and search engines landmarks and an outline. Plus tables, div, span and the one-main rule.

On this page

  • Buttons and badges
  • Inputs and selects
  • Cards and tables
  • Tabs and navigation
  • Dialogs and drawers
  • Toasts and empty states
  • Element, job and component
  • Common mistakes
  • Recap
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.