diff --git a/src/pages/en/reference/api-reference.md b/src/pages/en/reference/api-reference.md index 60057fcbe33b9..73283a020bff7 100644 --- a/src/pages/en/reference/api-reference.md +++ b/src/pages/en/reference/api-reference.md @@ -80,6 +80,33 @@ const posts = await Astro.glob('../pages/post/*.md'); ``` +### `Astro.props` + +`Astro.props` is an object containing any values that have been passed as [component attributes](/en/core-concepts/astro-components/#component-props). Layout components for `.md` and `.mdx` files receive frontmatter values as props. + +```astro {3} +--- +// ./src/components/Heading.astro +const { title, date } = Astro.props; +--- +
+

{title}

+

{date}

+
+``` + +```astro /title=".+"/ /date=".+"/ +--- +// ./src/pages/index.astro +import Heading from '../components/Heading.astro'; +--- + +``` + +📚 Learn more about how [Markdown and MDX Layouts](/en/guides/markdown-content/#frontmatter-layout) handle props. + +📚 Learn how to add [Typescript type definitions for your props](/en/guides/typescript/#component-props). + #### Astro Files Astro files have the following interface: