Skip to content

Allow components passed as slot prop to be used in the slot #8553

Open

Description

@Fuzzyma

What problem does this feature solve?

Example:

<template>
  <SomeComponent v-slot="{ SpecializedComponent }">
    <SpecializedComponent />
  </SomeComponent>
</template>

At the moment, vue does not consider components passed as slot property on render. Instead it complains about "SpecializedComponent" being unknown.

Why is this useful:

  1. Allow to render parent-child relationships in an easy way:

This basically allows to wrap the inner content of a parent component with some custom styling or whatnot.
A similar concept is used in vue-router to display the current page (<router-view>)

<template>
  <Table>
    <template #td="{ Child }">
      <td style="background: red">
        <Child />
      </td
    </template>
  </Table>
</template>
  1. Allow typed components that rely on props passed to the parent component
<template>
  <Table :data="typedData" v-slot="{ Column }">
    <Column prop="willErrorWithWrongKey" />
    <Column v-slot="{ row }">
      {{ row.typedProperties }}
    </Column>
  </Table>
</template>

Both cases are extremely useful for different reasons

What does the proposed API look like?

See above or look at this playground

Activity

  1. added
    ✨ feature request
    on Jun 12, 2023
  2. Alfred-Skyblue commented on Jun 12, 2023

    @Alfred-Skyblue
    Member

    Maybe you should use dynamic components rendering?

     <Table v-slot="{ Column }">
        <component :is="Column"></component>
      </Table>
  3. Fuzzyma commented on Jun 12, 2023

    @Fuzzyma
    Author

    @Alfred-Skyblue yes, this would work, but it gets kinda cumbersome and is very unintuitive. Usually you can just use any variable from your script section and render it as a component. Why the limitation for slotprops? The developer usually doenst know the internals and assumes that it just works "the same"

    // EDIT: I just tested it, and it doesnt show it. In fact, its not visible anywhere (no console warnings, nothing in the html). Weird

  4. jacekkarczmarczyk commented on Jun 12, 2023

    @jacekkarczmarczyk
    Contributor

    it does show when i tested it in your playground

  5. Fuzzyma commented on Jun 12, 2023

    @Fuzzyma
    Author

    You are right. This has to be a user error on my site then ^^

  6. Fuzzyma commented on Aug 5, 2024

    @Fuzzyma
    Author

    So it seems like Svelte 5 introduced a feature where capitalized variables can be rendered as component (found it on twitter: https://x.com/joyofcodedev/status/1820097509538070952).

    Maybe that would be a solution for slotProps in vues case. Even tho it would be a hell of a special case.
    Nevertheless wanted to write it down as a potential solution

  7. crutchcorn commented on Jul 6, 2025

    @crutchcorn

    I'm running into this same problem while trying to adapt this pattern to Vue from TanStack Form. Repro:

    https://stackblitz.com/edit/vue-v-slot-comp-map-bug-repro?file=src%2FApp.vue

    This would be great to get unblocked.

  8. madsh93 commented on Oct 5, 2025

    @madsh93

    As a Tanstack and Vue user, it would be great life improvement if this was possible.

  9. mkeyy0 commented on Nov 17, 2025

    @mkeyy0

    I also use tanstack/form, and this feature is very missing to be honest, would be nice to have! Also, if you use <component :is /> and TypeScript, you don't have any type definitions for your component, which is a big downside

  10. Angelovsky commented on Dec 1, 2025

    @Angelovsky

    Would be great to have this on the Vue side, as it's currently blocking some needed features around composition and type inference for us.

  11. added a commit that references this issue on May 6, 2026
    e17e603
  12. crutchcorn commented on Sep 18, 2026

    @crutchcorn

    This works in Vue 3.6 when it releases out of RC FWIW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✨ feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions