Vue isn’t just reactive. It’s also stylish.
Between first-class styling features and plug-and-play animation libraries, Vue empowers you to build beautiful interfaces without bloat. Here are 5 styling tricks and tools every modern Vue developer should have on their radar. Let the countdown begin!
Scoped styles in Vue prevent your CSS from leaking out — but what about styling nested components, slot content, or quickly dropping a global style? No problem! Vue has several built-in custom selectors to handle all of these.
<style scoped>
/* Targets elements within child components*/
:deep(.button) {
background-color: tomato;
}
/* Targets elements globally*/
:global(body) {
font-family: Inter, sans-serif;
}
/* Targets elements within a components slot (normally controlled by the parent)*/
:slotted(div) {
color: red;
}
</style>
This gives you precision control while keeping your styles modular. Plus the deep option works for content rendered with v-html too!
<transition>
You’re probably familiar with Vue’s transition component but did you know it also accepts class
props for each stage of the transition meaning that you can easily pair it with Tailwind CSS utilities for clean, utility-driven animations.
<script setup>
import { ref } from 'vue'
const show = ref(true)
</script>
<template>
<button @click="show = !show" class="mb-4">Toggle</button>
<transition
enter-active-class="transition duration-300 ease-out"
enter-from-class="opacity-0 translate-y-2"
enter-to-class="opacity-100 translate-y-0"
leave-active-class="transition duration-200 ease-in"
leave-from-class="opacity-100 translate-y-0"
leave-to-class="opacity-0 translate-y-2"
>
<div v-if="show" class="p-4 bg-white rounded shadow">
This box fades and slides!
</div>
</transition>
</template>
This little library from the makers of FormKit, is an no brainer to install in all your Vue apps. It animates DOM changes — list items, cards, toggles — with a single directive.
<div v-auto-animate>
<img
v-for="(src, index) in images"
:key="src"
...
/>
</div>
✨ No keyframes. No timing functions. Just plug and play! Works for toggling visibility, re-ordering lists, removing and adding items to list and more!
auto-animate directive used to animate a shuffle of images
@vueuse/motion is an animation engine with physics, timelines, and reactivity baked in. You can use it as a directive, a composable, or a component.
<template>
<div
v-motion
:initial="{ opacity: 0, y: 100 }"
:enter="{ opacity: 1, y: 0, scale: 1 }"
:variants="{ custom: { scale: 2 } }"
:hovered="{ scale: 1.2 }"
:delay="200"
:duration="1200"
/>
</template>
This plugin unlocks expressive, natural-feeling animations for modals, cards, pages, and gestures. It also works great for animating elements into view on landing pages.
v-bind()
in <style>
Impressed with what Vue has to offer so far? We certainly were!
This brings us to tip #1 a feature that ships with Vue core. 🎉
The v-bind()
function let’s you inject reactive state directly into your CSS.
<script setup>
const primaryColor = ref('#42b883')
</script>
<template>
<button class="btn">Click me</button>
</template>
<style scoped>
.btn {
background-color: v-bind(primaryColor);
}
</style>
v-bind is great for live theme switching, user customization, or mode-based styling.
Vue’s styling features go far beyond scoped styles. Whether you're animating layout changes with vue-auto-animate
, building smooth transitions with <transition>
, or binding reactivity straight into your CSS — Vue makes beautiful UIs effortless.
💬 Got a favorite Vue CSS trick or library that belongs on this list? Let us know in the comments or tag us on social. Want to take your app styles to the next level? Checkout our courses Vue.js Transitions and Animations and Tailwind CSS Fundamentals course.
Our goal is to be the number one source of Vue.js knowledge for all skill levels. We offer the knowledge of our industry leaders through awesome video courses for a ridiculously low price.
More than 200.000 users have already joined us. You are welcome too!
© All rights reserved. Made with ❤️ by BitterBrains, Inc.