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
- Atoms:
Button,Input,Label,Icon,Avatar. Smallest reusable pieces. - Molecules:
SearchBar(input + button),FormField(label + input + error). - Organisms:
Header(logo + nav + search),ProductCard,CommentList. - Templates: layout structure such as
DashboardLayoutwith slots for content. - 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 acomponents/uifolder 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// Atom2export function Button(props: React.ComponentProps<"button">) {3 return <button className="rounded bg-indigo-600 px-3 py-1.5 text-white" {...props} />;4}56// Atom7export function Input(props: React.ComponentProps<"input">) {8 return <input className="rounded border px-2 py-1.5" {...props} />;9}1011// Molecule: combines atoms12export 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}2021// Organism: combines molecules and atoms22export 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.