
Custom Events and Component Communication in Vue – `emit`, `provide/inject`, and When to Use a Store
} -->
Creating a design system is a powerful way to ensure consistency, scalability, and maintainability in your projects. Based on my experience with atomic design principles and Storybook, I’ll share practical tips on how to approach building your own design system from the ground up.
Design systems help teams:
Atomic design breaks down UI into five levels:
Starting with atoms ensures your system is modular and easy to maintain.
Let’s say you’ve created a basic Button.vue component. You want to document different visual variants using Storybook:
Button.vue
<template>
<button :class="`btn btn--${variant}`" @click="$emit('click')">
<slot />
</button>
</template>
<script setup lang="ts">
defineProps({
variant: {
type: String,
default: 'primary',
},
})
</script>
<style>
.btn {
padding: 0.5rem 1rem;
font-weight: bold;
border-radius: 0.375rem;
}
.btn--primary {
background: #2563eb;
color: white;
}
.btn--secondary {
background: #f3f4f6;
color: #111827;
}
</style>
Button.stories.ts
import Button from './Button.vue'
export default {
title: 'Atoms/Button',
component: Button,
argTypes: {
variant: {
control: { type: 'select' },
options: ['primary', 'secondary'],
},
default: { control: 'text' },
},
}
const Template = (args: any) => ({
components: { Button },
setup() {
return { args }
},
template: '<Button v-bind="args">{{ args.default }}</Button>',
})
export const Primary = Template.bind({})
Primary.args = {
variant: 'primary',
default: 'Click Me',
}
export const Secondary = Template.bind({})
Secondary.args = {
variant: 'secondary',
default: 'Cancel',
}
With this setup, your team can:
Preview and interact with the component in isolation
Test different variants visually
Use the story as documentation and reference during development
Building a design system is a marathon, not a sprint. Starting small with atomic components and consistent documentation pays off as your projects grow. Tools like Storybook make the process transparent and collaborative.
If you’re thinking about a design system for your team, focus first on clarity, reusability, and communication.
Bartłomiej Nowak
Programmer
Programmer focused on performance, simplicity, and good architecture. I enjoy working with modern JavaScript, TypeScript, and backend logic — building tools that scale and make sense.