Chapter 3

The Face You See: Frontend

Learn about HTML, CSS, JavaScript, React components, and Tailwind CSS.

What Is the Frontend?

The frontend is everything that runs in your browser — the buttons, text, colors, and layout you see and interact with. When you open StudyTracker, your browser downloads HTML, CSS, and JavaScript files, then renders them into the page you see.

The Three Layers

Think of a website like a person

HTML is the skeleton — it defines the structure (headings, paragraphs, buttons). CSS is the clothing and makeup — it controls how things look (colors, spacing, fonts). JavaScript is the brain and muscles — it makes things interactive (clicks, animations, data loading).

React: Building with Components

Instead of writing one giant HTML file, React lets you break your UI into small, reusable pieces called components. A Button, a Card, a Sidebar — each is a component. You compose them together like LEGO bricks to build entire pages.

Component

A self-contained piece of UI that manages its own appearance and behavior. Components can receive props (inputs) and maintain state (internal data that changes over time).

Tailwind CSS: Styling Without Leaving Your Code

Traditional CSS means writing styles in a separate file. Tailwind CSS takes a different approach — you apply pre-built utility classes directly in your HTML/JSX. Instead of writing .button { background-color: blue; padding: 8px 16px; } in a CSS file, you write className="bg-blue-500 px-4 py-2" right on the element.

Every visual element in StudyTracker is styled with Tailwind classes. Change bg-blue-500 to bg-red-500 and the button turns red — instant feedback!

Next.js: The Framework That Ties It All Together

Next.js is a React framework that adds powerful features on top: file-based routing (folders = URLs), server-side rendering (faster page loads), API routes (backend in the same project), and automatic code splitting (only load what you need).

Try It Yourself: Component Playground

Below is a live playground with actual StudyTracker UI components. Change their props (properties) and watch how the output changes in real time:

Props

Variant
Size
Text

Preview

Code

<Button variant="default" size="default">
  Click me
</Button>

How a Component Works

Here's a simplified React component — it receives props and returns JSX (HTML-like syntax in JavaScript):

src/components/ui/button.tsx
const Button = ({ children, variant = "default", onClick }) => {
  return (
    <button
      className={buttonVariants({ variant })}
      onClick={onClick}
    >
      {children}
    </button>
  );
};
Every page in StudyTracker is built from components. The Dashboard page alone uses 15+ components — Card, Progress, Badge, Button, and more. Learning to think in components is the key to understanding modern frontend development.

Test Your Knowledge

Question 1 of 3Score: 0

What are the three layers of frontend technology?