Custom Directives

Learn about custom directives in Vue and practice writing them.

Directives let us attach encapsulated logic to otherwise unrelated components. Unlike mixins or even renderless components, they don’t imply any relationship between the components that use them. Directives are independent.

Vue offers many different directives, such as v-slot for using slots, and v-model for @input and :value, which is syntactic sugar. In addition, there are many more directives, such as v-if, v-for, and v-bind.

Get hands-on with 1400+ tech skills courses.