Suggest an editImprove this articleRefine the answer for “Can you use several slots in a single component?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**Yes**, you can use several slots in a single component - this is done with named slots via the name attribute. **Key point:** Vue does not limit the number of slots, as long as each has a unique name and the parent fills it with the matching #slotName.Shown above the full answer for quick recall.Answer (EN)ImageYes, **you can use several slots in a single component** - it's standard practice in Vue. For that you use **named slots**. --- ## How do several slots work? In the child component, you declare several `<slot>` elements with the **name** attribute: #### Child component (Card.vue) ```vue <template> <div class="card"> <header class="card-header"> <slot name="header"></slot> </header> <div class="card-body"> <slot></slot> <!-- default slot --> </div> <footer class="card-footer"> <slot name="footer"></slot> </footer> </div> </template> ``` --- ## The parent component can fill each slot #### Parent ```vue <Card> <template #header> <h2>Title</h2> </template> <p>The card's main text</p> <!-- Default slot --> <template #footer> <button>OK</button> </template> </Card> ``` --- ## The final result: - `header` receives `<h2>Title</h2>` - the default slot receives `<p>The card's main text...</p>` - `footer` receives the button --- ## Yes, you can have as many slots as you want - 2 slots - 5 slots - 10 slots Vue doesn't limit the number; all that matters is: - each named slot has a unique name - the parent uses the matching `#slotName`For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.