Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Vue.js Components Fundamentals

Component Slots

In this lesson, we'll learn how to pass HTML to our Vue.js components using slots. Slots are an awesome feature of Vue.js, and this lesson will teach you what you need to know to get started.

Solution to the slots exercise


If you need to pass HTML to your components, use slots. If you need to pass data, use props.

Important Note

Since Vue.js 3 became the default you must now specify version 2 when getting Vue from a CDN.

<script src="https://unpkg.com/[email protected]"></script>