Astro · Components and layouts

Accept props

Read props from Astro.props, with types.

---
interface Props {
  title: string;
  featured?: boolean;
}
const { title, featured = false } = Astro.props;
---
<article class:list={["card", { featured }]}>
  <h2>{title}</h2>
</article>

Official Astro documentation

More components and layouts commands

All components and layouts commands · Astro cheatsheet

Was this page helpful?