Skip to content

Commit

Permalink
docs(guide/components/slots): clarify slot presence phrasing (vuejs#3124
Browse files Browse the repository at this point in the history
)

* docs(guide/components/slots): clarify slot presence phrasing

The original phrasing "whether or not a slot is present" was potentially misleading, as it suggested checking the existence of the slot itself rather than whether content was passed to it. Updated the explanation to clarify this distinction for better readability and accuracy.

* docs(guide/components/slots): clarify slot presence phrasing (2)

The phrase "When the header/footer/default is present..." could be interpreted as referring to the slot's definition, rather than whether content is provided for the slot
  • Loading branch information
alexchexes authored and szymonlicau committed Dec 9, 2024
1 parent fd997b5 commit 39dd8c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/guide/components/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ function BaseLayout(slots) {

## Conditional Slots {#conditional-slots}

Sometimes you want to render something based on whether or not a slot is present.
Sometimes you want to render something based on whether or not content has been passed to a slot.

You can use the [$slots](/api/component-instance.html#slots) property in combination with a [v-if](/guide/essentials/conditional.html#v-if) to achieve this.

In the example below we define a Card component with three conditional slots: `header`, `footer` and the `default` one.
When the header / footer / default is present we want to wrap them to provide additional styling:
When content for the header / footer / default is present, we want to wrap it to provide additional styling:

```vue-html
<template>
Expand Down

0 comments on commit 39dd8c7

Please sign in to comment.