Skip to content
Discussion options

You must be logged in to vote

MDX does support passing props to use like this but it works a little bit differently. The Astro global is not available and instead you access a props object directly. Any frontmatter between the --- delimiters at the top of the file should just be YAML or TOML data like in a Markdown file.

Here’s an adapted version of your example:

---
// src/partials/Test.mdx
---

<div>

**{props.productName}** is awesome!

<div/>

As far as I know, there’s no support for specifying prop types like you did in the version inspired by .astro syntax.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

@delucis
Comment options

@mavam
Comment options

Answer selected by mavam
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants