DEV Community

Cover image for Using atomic design in Vue: The best approach for scalable component architecture
Dmitrii Zakharov
Dmitrii Zakharov

Posted on

Using atomic design in Vue: The best approach for scalable component architecture

Selecting the appropriate architecture is crucial in any frontend project. A poorly chosen structure can transform even a small application into a confusing mess that is difficult to scale, test, or maintain.

Does every existing architecture scale well by default
No, not all of them do.

When choosing a component architecture, I focus on three key aspects: 
 -  Clarity  -  Is the structure easy to navigate and understand? 
 -  Scalability  -  Can it grow alongside the application?
 -  Ease of Use  -  Does it enhance or hinder the developer experience?

One of the best frontend architectures I have encountered in my career is Atomic Design. If you're not familiar with the concept, I highly recommend starting with the original explanation by Brad Frost.


Why Atomic Design?

Atomic Design offers a clear mental framework for building user interface (UI) systems by breaking down components into five hierarchical levels:

  1. Atoms  -  The basic building blocks (e.g., buttons, input fields).
  2. Molecules  -  Simple combinations of atoms (e.g., an input field combined with a label).
  3. Organisms  -  More complex components made up of molecules and atoms (e.g., a header, a form).
  4. Templates  -  Page-level layouts that contain placeholder content.
  5. Pages  -  Final pages filled with actual content.

In practice, I often skip the Templates stage, as it can seem unnecessary. You can still achieve a clean separation of elements without them.


Applying Atomic Design in a Vue Project

Imagine we are creating a straightforward "Contact Us" page. This page may consist of the following elements:

  • Headers and subheaders.
  • Descriptive text and instructions.
  • A feedback form that includes input fields and a submission button.
  • A header and footer for navigation and branding purposes.

Page


Here's how we would organize that using Atomic Design in a Vue-based project:

🔹 Atoms

Atoms are the smallest components and should be reusable across your application. Keep them stateless and focused.

  • Logo.vue — logo contains an image or text.
  • Link.vue — link component used in the footer.
  • Input.vue, Button.vue — form elements.

🔹 Molecules

These are simple component compositions. They can receive data via props and render a structure of atoms.

  • Header.vue – composed of Logo, maybe some navigation links.
  • Footer.vue – combines text blocks and atomized Link components.

🔹 Organisms

Organisms are more complex components that combine both UI and internal logic. They often serve as the core building blocks for full-page layouts and can include other components such as atoms, molecules, or even other organisms.

  • FeedbackForm.vue – includes Input, Textarea, Button, and handles internal logic like validation and submission.

🔹 Pages

Pages consist of various components.

  • ContactUs.vue - includes FeedbackForm, Header, Footer.

Folder Structure Example

Here's a sample directory layout for this contact page:

Architecture

Atomic Design works incredibly well with Vue (and other frameworks like React). It creates a shared vocabulary and natural hierarchy that reflects how we think about interfaces. More importantly, it makes it easier to:

  • Maintain consistency across your UI
  • Reuse components with confidence
  • Scale your application without losing control

If you're starting a new Vue project or refactoring an existing one, try adopting Atomic Design. You'll quickly see the benefits.


If you found this useful, leave a ❤️ or 🦄 so others can discover it too!

Top comments (0)