UI Elements & Components for AI Coders | SheCodes
Beginner 18 min read

UI Elements for AI Coders

Every user interface component you need to know. Learn the name, see the example, and know exactly what to ask AI for. Also see: CSS Concepts, Colors, Sections Gallery.

In this chapter

  • The basic building blocks every UI is made of
  • Buttons, inputs, cards, modals, and toasts explained
  • How to name UI elements so AI builds the right one
  • Patterns to keep your interface consistent
Live example

Buttons

Buttons trigger actions. Different styles communicate different levels of importance.

Live example
Live Examples
Primary Button The main CTA. Use for "Sign Up" or "Submit." Draws the most attention.
Secondary Button Less prominent, outlined style. Use for "Cancel" or "Learn More."
Ghost Button Minimal styling. For tertiary actions that shouldn't draw attention.
Danger Button Red color warns of destructive actions like "Delete" or "Remove."

Floating Action Button (FAB)

A circular button that floats above content, usually in a fixed position. Common in Material Design.

Live example
Live Examples

Form Inputs

Input elements let users enter data: text, email, password, dropdown, textarea, and more.

Live example
Live Examples

Toggles, Checkboxes & Radios

Binary or multiple-choice selection controls.

Live example
Live Examples
Toggle Switch
Checkboxes
Radio Buttons

A navigation aid showing the user's current location in the site hierarchy.

Live example
Live Example
Home / Products / Electronics / Headphones

Progress Bars

Visual indicators showing how much of a task or process is complete.

Live example
Live Examples
Upload Progress25%
Course Completion60%
Storage Used90%

Badges, Tags & Chips

Small labels used to categorize, label, or show status.

Live example
Badges / Tags
Primary New Active Pending Urgent Info
Chips (removable)
React × JavaScript × CSS ×

Alerts & Notifications

Messages that provide feedback: success, warnings, errors, or informational notices.

Live example
Live Examples
Informational alert: useful for tips or neutral messages.
Success! Your changes have been saved.
Warning: Your session will expire in 5 minutes.
Error: Failed to upload file. Please try again.

Modals & Dialogs

Overlay windows that appear on top of main content for confirmations, forms, or important messages.

Live example
Click to Preview
Example Modal

This is a modal dialog. It overlays the page and requires user interaction before returning to the main content.

Modal Blocks interaction with the rest of the page. Has an overlay behind it.
Dialog Can be non-blocking. Often used for "Are you sure?" confirmations.
Lightbox A modal specifically for viewing images or media at larger size.

Tabs

Allow users to switch between different views within the same page.

Live example
Live Example

This is the Overview tab content. Tabs help organize content into logical sections.

This is the Features tab. Users can switch between tabs without reloading the page.

This is the Pricing tab. Each tab panel contains its own content.

Accordion / Collapsible

Expandable content sections. Great for FAQs, settings, or content hidden by default.

Live example
Live Example
What is an accordion?
A vertically stacked list where each item can be expanded or collapsed to reveal content. They save screen space.
When should I use one?
For FAQ sections, settings pages, or content where users only need one section at a time.
How do I ask AI for one?
Try: "Create an accordion with 5 FAQ items. Clicking one should collapse the others."

Avatars

Small circular images or initials representing a user.

Live example
Live Examples
S
M
L
JD
AK

Tooltips

Small popups on hover providing extra information.

Live example
Hover Over These
This is a tooltip!
Tooltips show on hover

Tables

Structured data in rows and columns for lists, comparisons, and data-heavy interfaces.

Live example
Live Example
Name Role Status Action
Alex Johnson Developer Active Edit
Sarah Chen Designer Active Edit
Mike Wilson Manager Away Edit

Cards

Self-contained content containers. The most common way to group related information.

Live example
Live Examples
📄
Basic Card

Cards group related content. They can contain text, images, buttons, or any other elements.

🌟
Feature Card

Commonly used to showcase features, products, team members, or pricing plans.

Popular New

Skeleton Loaders

Placeholder content that mimics the shape of real content while loading.

Live example
Live Example

Spinners / Loading Indicators

Animated indicators telling the user something is loading.

Live example
Live Examples
Loading...

Pagination

Navigation for moving between pages of content.

Live example
Live Example

Hero Section

The large, prominent area at the top of a landing page with headline, subtitle, and CTA.

Headline The main bold text: your most important message or value proposition.
Subtitle Supporting text below the headline providing more context.
CTA The button(s): "Get Started," "Sign Up Free," "Learn More."
Above the Fold Content visible without scrolling. The hero is always above the fold.

An input specifically for searching content, usually with a magnifying glass icon.

Live example
Live Example

The horizontal bar at the top of every page with logo, links, and actions. The most essential page element.

Live example
Live Example
Logo Your brand mark, usually top-left. Clicking it goes to the homepage.
Nav Links The main pages: Home, About, Features, Pricing. Keep it to 4–6 links.
CTA Buttons Log In / Sign Up or a primary action button, usually top-right.

The top section of a page combining the navbar with a page title, subtitle, or breadcrumbs. Different from a navbar, a header wraps the nav and adds context.

Live example
Live Example
MyApp
Home Blog Getting Started
Getting Started with AI

Everything you need to know to start building with AI tools.

Navbar vs Header A navbar is just the navigation links. A header wraps the navbar and adds page-level context like titles.
Page Title The large text telling users which page they're on. Often below the nav, inside the header.
Breadcrumbs A trail (Home > Blog > Post) often lives inside the header, above the page title.

The section at the very bottom of every page with links, copyright, and contact info.

Live example
Live Example
Product
  • Features
  • Pricing
  • Changelog
Company
  • About
  • Blog
  • Careers
Support
  • Help Center
  • Contact
  • Status
Legal
  • Privacy
  • Terms
  • Cookies
© 2026 MyApp. All rights reserved.

A vertical navigation panel on the left (or right) side of the page. Common in dashboards and admin panels.

Live example
Live Example
Dashboard
Home
Analytics
Users
Messages
Settings

Main content area goes here. The sidebar stays visible while the content scrolls.

Hamburger Menu

The three-line icon (☰) that opens a mobile navigation menu. Essential for responsive websites.

Live example
Click to Toggle
MyApp
Home
Features
Pricing
Contact

A menu that appears when clicking a button, showing a list of options or actions.

Live example
Click to Open
Options
Edit
Duplicate
Share
Delete

Mega Menu

A large dropdown that spans multiple columns, showing categories and sub-links. Used on complex sites like e-commerce.

Live example
Example Layout
Clothing
  • T-Shirts
  • Jeans
  • Jackets
  • Dresses
Electronics
  • Phones
  • Laptops
  • Headphones
  • Cameras
Home
  • Furniture
  • Kitchen
  • Decor
  • Lighting
Sports
  • Running
  • Yoga
  • Cycling
  • Swimming

Bottom Navigation

A fixed bar at the bottom of mobile screens with 3–5 icon tabs. Think Instagram or TikTok.

Live example
Live Example (Mobile Style)
Page content
Home
Search
Create
Likes
Profile

Stepper / Wizard

A multi-step progress indicator showing where the user is in a process. Used for sign-up flows, checkouts, and forms.

Live example
Interactive Example
1Account 2Details 3Payment 4Confirm

Back to Top Button

A floating button that scrolls the user back to the top of the page. Appears after scrolling down.

Live example
Example
Usually appears in the bottom-right corner after scrolling down.

A component that cycles through items (images, cards, testimonials) one at a time with arrows or dots.

Live example
Interactive Example
Slide 1: Feature Highlight
Slide 2: Customer Quote
Slide 3: Product Showcase

Timeline

A vertical or horizontal sequence of events in chronological order. Great for changelogs, histories, or process flows.

Live example
Live Example
Today
Project launched
Version 1.0 is live!
Yesterday
Final testing
All tests passed.
3 days ago
Design approved
Stakeholders signed off.

Pricing Table

Side-by-side plan comparison cards showing features and prices. A landing page staple.

Live example
Live Example
Free
$0
/month
  • 1 project
  • Basic support
  • 1 GB storage
Pro
$19
/month
  • 10 projects
  • Priority support
  • 50 GB storage
Team
$49
/month
  • Unlimited
  • 24/7 support
  • 500 GB storage

Testimonials

Quotes from happy customers or users. Builds trust and social proof on landing pages.

Live example
Live Example

“This tool saved me 20 hours a week. I can't imagine going back.”

S
Sarah K.
Founder

“The easiest onboarding I've ever experienced. Beautiful UI too.”

J
James R.
Designer

Stats / Counters

Big numbers that highlight achievements: users, downloads, uptime. Common in hero sections and about pages.

Live example
Live Example
10K+
Users
99.9%
Uptime
50M
Requests
4.9★
Rating

CTA Section

A prominent Call-to-Action block urging users to sign up, start a trial, or take the next step.

Live example
Live Example
Ready to get started?

Join thousands of creators building amazing things. Free for 14 days.

Feature Grid

A grid of icons + short descriptions showcasing your product's features. A landing page essential.

Live example
Live Example
Lightning Fast
Built for speed from the ground up.
Secure
Enterprise-grade encryption.
Global CDN
Servers on every continent.
99.9% Uptime
We never go down.
Team Ready
Collaborate with your whole team.
Loved by Users
4.9 stars from 10K reviews.

A thin strip at the very top of the page with a promotional message or important notice.

Live example
Live Examples
New: Version 2.0 is here! Learn more →
Scheduled maintenance on Sunday, 2am–4am UTC

Toast Notifications

Small, auto-dismissing messages that slide in to confirm an action. Different from alerts, they disappear on their own.

Live example
Click to Show
Changes saved successfully!
Changes saved successfully!

Popover

A small floating panel triggered by clicking (not hovering) on an element. More content than a tooltip.

Live example
Example
Click me
What is a popover?

A popover shows more detail than a tooltip. It can contain links, buttons, and formatted text.

Slide-over / Sheet

A panel that slides in from the side of the screen. Used for filters, settings, or detail views without leaving the page.

Live example
Click to Open
Filters

This panel slides in from the right. It's perfect for filters, settings, or viewing details without navigating away.

Command Palette

A search-driven overlay (usually Cmd+K or Ctrl+K) for quickly navigating or running actions. Popular in dev tools and modern apps.

Live example
Example Layout
Type a command or search... ESC
Recent
Dashboard
Settings
Team Members

Empty State

What users see when there's no content yet: no search results, no items, no messages. A chance to guide them.

Live example
Live Example
No projects yet

Create your first project to get started. It only takes a minute.

Error Page (404 / 500)

Custom pages shown when something goes wrong: page not found (404) or server error (500).

Live example
Example 404
404
Page not found

The page you're looking for doesn't exist or has been moved.

Rating (Stars)

A star-based input letting users rate something from 1 to 5. Used in reviews, feedback, and product pages.

Live example
Click to Rate
1 / 5 2 / 5 3 / 5 4 / 5 5 / 5

List Items

Structured rows of content: emails, notifications, settings, or any repeated data.

Live example
Live Example
New message from Sarah2m ago
Hey, can you review the latest...
Deployment complete1h ago
v2.3.1 deployed to production
Team invite accepted3h ago
James joined the workspace

File Upload / Dropzone

An area where users can drag-and-drop or click to upload files. Essential for any app that handles media or documents.

Live example
Live Example

Drop files here or click to upload

PNG, JPG, PDF up to 10MB

Date Picker

A calendar popup that lets users select a date. Used in booking, scheduling, and form fields.

Live example
Example Layout
April 2026
Su
Mo
Tu
We
Th
Fr
Sa
1234567 891011121314 15161718192021 22232425262728 2930

Divider / Separator

A simple horizontal (or vertical) line separating sections of content.

Live example
Live Examples
Simple line

OR

Section 2

Dark Mode Toggle

A switch that lets users flip between light and dark themes. Usually a sun/moon icon.

Live example
Click to Toggle

A banner (usually at the bottom) asking users to accept cookies. Required by GDPR in many countries.

Live example
Example

We use cookies to improve your experience. By continuing to browse, you agree to our use of cookies.

Social Share Buttons

A row of icons letting users share content to Twitter/X, Facebook, LinkedIn, etc.

Live example
Live Example
Share this article

A header that stays fixed at the top as you scroll. Keeps navigation always accessible.

position: sticky CSS property that makes an element stick when it reaches a scroll position.
Shadow on Scroll A common pattern: add a shadow to the navbar once the user starts scrolling down.

Frequently Asked Questions

What UI elements does every website need?

At minimum: a navbar, buttons, and a footer. Most sites also need cards (for displaying content), forms (for user input), and some kind of feedback element (toast notifications or alerts). Start with these basics and add more as your project grows.

How do I ask AI to build a specific component?

Use the component's real name, like 'modal', 'dropdown', 'accordion', or 'toast'. AI tools recognize these terms and will build exactly what you mean. Add details like 'with a close button' or 'that closes when clicking outside' for better results.

Should I build components from scratch or use a library?

Use a library like shadcn/ui. It gives you pre-built, accessible components that look professional. Building from scratch teaches you more, but a component library gets you to a polished result much faster, especially when paired with AI tools.