ReactEasy

What is Atomic Design?

Atomic Design, by Brad Frost, is a methodology for building UI systems in five levels: atoms (basic elements like buttons and inputs), molecules (small groups like a search field with a button), organisms (sections like a header), templates (page layouts without real content) and pages (templates filled with real data). It maps naturally onto React's component composition.

The levels

  1. Atoms: Button, Input, Label, Icon, Avatar. Smallest reusable pieces.
  2. Molecules: SearchBar (input + button), FormField (label + input + error).
  3. Organisms: Header (logo + nav + search), ProductCard, CommentList.
  4. Templates: layout structure such as DashboardLayout with slots for content.
  5. Pages: a template with real data, typically your route components.

Benefits

  • A shared vocabulary between designers and developers.
  • Encourages reuse and consistency.
  • Pairs with design tokens, Storybook and Figma component libraries.

Criticisms and practical advice

  • Teams often argue whether something is a molecule or organism; do not let classification slow you down.
  • Strict folders like atoms/, molecules/ can make features harder to find; many teams use the ideas but keep a components/ui folder for primitives and feature folders for the rest.
  • Modern design systems (shadcn/ui, Radix-based kits) follow a similar layering: primitives, composed components, blocks.

Code example

tsx
1// Atom
2export function Button(props: React.ComponentProps<"button">) {
3 return <button className="rounded bg-indigo-600 px-3 py-1.5 text-white" {...props} />;
4}
5
6// Atom
7export function Input(props: React.ComponentProps<"input">) {
8 return <input className="rounded border px-2 py-1.5" {...props} />;
9}
10
11// Molecule: combines atoms
12export function SearchBar({ onSearch }: { onSearch: (q: string) => void }) {
13 return (
14 <form role="search" onSubmit={(e) => { e.preventDefault(); onSearch(String(new FormData(e.currentTarget).get("q"))); }}>
15 <Input name="q" placeholder="Search…" aria-label="Search" />
16 <Button type="submit">Go</Button>
17 </form>
18 );
19}
20
21// Organism: combines molecules and atoms
22export function Header({ onSearch }: { onSearch: (q: string) => void }) {
23 return (
24 <header className="flex items-center justify-between p-4">
25 <a href="/">Acme</a>
26 <SearchBar onSearch={onSearch} />
27 </header>
28 );
29}

Practice this question

Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the React set.

Open in study app