Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/built-in-directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ Denote named slots or scoped slots that expect to receive props.
- **Limited to:**

- `<template>`
- [components](/guide/components/slots#scoped-slots) (for a lone default slot with props)
- [components](/guide/components/slots#scoped-slots) (for a lone default or named slot)

- **Example**

Expand Down
4 changes: 3 additions & 1 deletion src/guide/components/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ A `<slot>` outlet without `name` implicitly has the name "default".

In a parent component using `<BaseLayout>`, we need a way to pass multiple slot content fragments, each targeting a different slot outlet. This is where **named slots** come in.

To pass a named slot, we need to use a `<template>` element with the `v-slot` directive, and then pass the name of the slot as an argument to `v-slot`:
To pass a named slot, we use a `<template>` element with the `v-slot` directive, and then pass the name of the slot as an argument to `v-slot`:

```vue-html
<BaseLayout>
Expand All @@ -211,6 +211,8 @@ To pass a named slot, we need to use a `<template>` element with the `v-slot` di

`v-slot` has a dedicated shorthand `#`, so `<template v-slot:header>` can be shortened to just `<template #header>`. Think of it as "render this template fragment in the child component's 'header' slot".

If the named slot is the only slot being passed, `v-slot` can also be used directly on the component, as in `<BaseLayout #header>`. All of the component's content is then passed to that slot.

![Diagram showing multiple named slots in a layout component, with content from the parent being directed to the corresponding header, main, and footer slots](./images/named-slots.png)

<!-- https://www.figma.com/file/2BhP8gVZevttBu9oUmUUyz/named-slot -->
Expand Down