Skip to content

How can I send props to an slotted component? #2008

Closed Answered by brc-dd
isorna asked this question in Q&A
Discussion options

You must be logged in to vote

Create a Layout.vue file:

<script setup lang="ts">
import DefaultTheme from 'vitepress/theme';
import BreadCrumbs from './BreadCrumbs.vue';
</script>

<template>
  <DefaultTheme.Layout>
    <template #doc-before>
      <BreadCrumbs :breadCrumbs="$frontmatter.breadcrumbs" />
    </template>
  </DefaultTheme.Layout>
</template>

Then use it your theme:

// .vitepress/theme/index.ts

import DefaultTheme from 'vitepress/theme';
import Layout from '../components/Layout.vue';

export default {
  ...DefaultTheme,
  Layout,
};

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
3 replies
@isorna
Comment options

@brc-dd
Comment options

@isorna
Comment options

Answer selected by isorna
Comment options

You must be logged in to vote
7 replies
@brc-dd
Comment options

@Alexufo
Comment options

@brc-dd
Comment options

@Alexufo
Comment options

@brc-dd
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants