Styling is the process of designing and customizing the appearance of a React application.
Without styling, an application is functional but visually plain.
Plain HTML
Basic Layout
No Visual Design
With proper styling, applications become:
In this module, you'll learn the three most common styling approaches used in React:
Note: Although we'll briefly introduce all three, Tailwind CSS will be the primary styling solution used throughout this course.
Good styling does much more than make an application look beautiful.
It improves:
Without styling:
<button>
Login
</button>
Output:
Simple browser button
With styling:
Users immediately recognize it as an interactive button.
There are several ways to style React applications.
The most common approaches are:
Popular React styling solutions include:
Each approach has different strengths and use cases.
Tailwind CSS is a Utility-First CSS Framework.
Instead of writing CSS files, developers build designs by combining small utility classes directly inside JSX.
Traditional CSS requires writing styles separately.
Example:
.button {
background: blue;
padding: 12px;
border-radius: 8px;
}
Then applying the class:
<button class="button">
Login
</button>
Tailwind removes this extra step.
Instead, styles are written directly inside JSX.
<button
className="
bg-blue-500
px-4
py-2
rounded
"
>
Login
</button>
No separate CSS file is needed.
Traditional workflow:
Write CSS
│
▼
Create Class
│
▼
Apply Class
Tailwind workflow:
Write Utility Classes Directly
│
▼
Component Ready
Everything happens inside the JSX.
.card {
padding: 20px;
background: white;
border-radius: 12px;
}
<div class="card">
</div>
<div
className="
p-5
bg-white
rounded-xl
"
>
</div>
Same result.
Less context switching.
Tailwind has become one of the most popular styling frameworks because it offers:
It is especially popular with:
function Button() {
return (
<button
className="
bg-indigo-600
text-white
px-4
py-2
rounded-lg
"
>
Click Me
</button>
);
}
Output:
A blue button with:
Tailwind includes responsive utilities.
<div
className="
text-sm
md:text-lg
lg:text-2xl
"
>
Responsive Text
</div>
Explanation:
| Screen Size | Text Size |
|---|---|
| Mobile | text-sm |
| Medium Screens | text-lg |
| Large Screens | text-2xl |
This allows one component to automatically adapt to different screen sizes.
Interactive styles are simple.
<button
className="
bg-blue-500
hover:bg-blue-700
text-white
"
>
Hover Me
</button>
When the mouse moves over the button, the background changes automatically.
Throughout this course, Tailwind CSS will be used because it is:
Almost every practical project in this course will use Tailwind CSS.
CSS Modules provide locally scoped CSS.
Unlike traditional CSS, styles only affect the component they belong to.
Normal CSS is global.
.button {
color: red;
}
If another component also has a .button class, both styles may conflict.
This becomes difficult to manage in large applications.
Each component gets its own private CSS file.
Project structure:
components/
│
├── Button.jsx
└── Button.module.css
.button {
background: blue;
color: white;
}
import styles from "./Button.module.css";
Using the class:
<button className={styles.button}>
Click
</button>
React automatically generates a unique class name.
No conflicts occur.
Button.jsx
│
▼
Button.module.css
│
▼
Scoped Styling
Only the Button component receives these styles.
CSS Modules are excellent for:
Compared to Tailwind:
Panda CSS is a modern styling solution that combines CSS-in-JS with static CSS generation.
It also supports Design Tokens and excellent TypeScript integration.
Instead of writing CSS files, Panda CSS generates optimized CSS automatically.
Example:
import { css } from "../styled-system/css";
function Button() {
return (
<button
className={css({
bg: "blue.500",
color: "white",
px: 4,
py: 2
})}
>
Click
</button>
);
}
The css() function converts the object into optimized CSS classes.
Panda CSS includes:
Design Tokens define reusable design values.
Example:
colors: {
primary: "#2563EB",
secondary: "#9333EA"
}
Instead of repeatedly writing color codes throughout the project, components reference these tokens.
Benefits:
Compared to Tailwind:
| Feature | Tailwind CSS | CSS Modules | Panda CSS |
|---|---|---|---|
| Learning Curve | Easy | Easy | Moderate |
| Popularity | Very High | High | Growing |
| Performance | Excellent | Excellent | Excellent |
| Type Safety | No | No | Yes |
| Setup | Simple | Simple | Moderate |
| React Integration | Excellent | Good | Excellent |
| Large Projects | Excellent | Good | Excellent |
Best for:
Best for:
Best for:
Today, most modern React applications use:
React
│
▼
Tailwind CSS
Especially when working with:
Tailwind has become the default styling choice for many frontend teams.
This course introduces:
so you understand the broader React styling ecosystem.
However, every practical project and example will primarily use Tailwind CSS because it provides:
Use consistent spacing, colors, and typography throughout your application.
Tailwind works naturally with reusable React components.
If many components share the same utilities, consider creating reusable components.
Instead of:
<button className="...many classes...">
Create:
<Button />
Design for mobile first.
Example:
className="
text-sm
md:text-lg
lg:text-xl
"
Store styling-related assets inside dedicated folders.
src/
│
├── assets/
├── components/
├── styles/
└── App.jsx
| Technology | Purpose |
|---|---|
| Tailwind CSS | Utility-first styling |
| CSS Modules | Scoped component CSS |
| Panda CSS | Type-safe styling system |
| Utility Classes | Predefined CSS helpers |
| Design Tokens | Reusable design values |
| Scoped CSS | Component-specific styling |
Modern React applications have several styling options.
Tailwind CSS
│
▼
Utility-First Styling
CSS Modules
│
▼
Scoped Component CSS
Panda CSS
│
▼
Type-Safe Design System
For this course, the primary workflow will be:
React
│
▼
Tailwind CSS
│
▼
Modern Responsive UI
Tailwind CSS offers the best balance of simplicity, speed, responsiveness, maintainability, and industry adoption, making it the preferred styling solution for modern React development.