v-slot
Last updated
What is v-slot?
The v-slot directive to define slots in components, allowing you to pass and render content dynamically inside a component.
For named slots, you use v-slot with a specific slot name. This lets you pass different content to different parts of a component:
<template>
<custom-component>
<template v-slot:header>
<h1>Header Content</h1>
</template>
<template v-slot:footer>
<p>Footer Content</p>
</template>
</custom-component>
</template>
The shorthand for v-slot is #, for example v-slot:header becomes #header.
Free resources to learn v-slot
- Official docsv-slot documentation
More in stage 10: SSG
v-slot: common questions
Can I learn v-slot in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain v-slot in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this v-slot tutorial for beginners?
It is lesson 55 of 84 in the free Vue roadmap, in stage 10, SSG. If you are new to Vue, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.