Components let you easily reuse a piece of UI or styling consistently. You can use them not just in .astro files, but also in .mdx files.
tipMDX is a format that lets you write JSX embedded inside Markdown. And it has no difference with markdown files in other ways.
tipSome components are both available in
.mdand.mdxfiles, but some are only available in.mdxfiles. In.mdfiles, you can use components with remark-directive. Components that available in.mdfiles will have amdtab in the example.
Containers#
Collapse#
Hey there, I’m opened by default!
<Collapse title="Click me">This is the content of the collapse.</Collapse><Collapse title="Default open!" open>  Hey there, I'm opened by default!</Collapse>:::collapse{title="Click me"}This is the content of the collapse.::::::collapse{title="Default open!" open}Hey there, I'm opened by default!:::Tabs#
This is the content of common Tab 2
This is the content of sync Tab 1, sync with next Tabs.
npm install foo barpnpm add foo bar<Tabs>  <TabItem label="Foo">This is the content of common Tab 1</TabItem>  <TabItem label="Bar" active>    This is the content of common Tab 2  </TabItem></Tabs><Tabs>  <TabItem label="Lorem">This is the content of spoiler Tab 1</TabItem>  <TabItem label="Ipsum">This is the content of spoiler Tab 2</TabItem></Tabs><Tabs syncKey="test-tabs-sync">  <TabItem label="Tab 1" active>    This is the content of sync Tab 1, sync with next Tabs.  </TabItem>  <TabItem label="Tab 2">This is the content of sync Tab 2, sync with next Tabs.</TabItem></Tabs><Tabs syncKey="test-tabs-sync">  <TabItem label="NPM" active>    ```bash    npm install foo bar    ```  </TabItem>  <TabItem label="PNPM">    ```bash    pnpm add foo bar    ```  </TabItem></Tabs>Repl#
<div>Hello</div><Repl>  <div class="text-center">Hello</div>  <Fragment slot="desc">    ```jsx    <div class="text-center">Hello</div>    ```  </Fragment></Repl>FileTree#
<FileTree  files={[    {      name: "src",      children: [        { name: "components", children: ["Button.astro", "Card.astro"] },        { name: "layouts", children: ["BaseLayout.astro"] },        { name: "pages", children: ["index.astro", "about.astro"] },      ],    },    { name: "public", children: ["favicon.ico", "robots.txt"] },    ".gitignore",    "astro.config.mjs",    "package.json",    "README.md",  ]}/>:::filetree- src  - components    - Button.astro    - Card.astro  - layouts    - BaseLayout.astro  - pages    - index.astro    - about.astro- public  - favicon.ico  - robots.txt- .gitignore- astro.config.mjs- package.json- README.md:::note
FileTreehas an optionalopenprop for both.mdxand.mdcomponents to make the tree expanded by default.
Inline Containers#
Tooltip#
Hover me
Hover me
Hover me
Hover me
<Tooltip tip="I'm here!" position="top">  Hover me</Tooltip><Tooltip tip="I'm here!" position="bottom">  Hover me</Tooltip><Tooltip tip="I'm here!" position="left">  Hover me</Tooltip><Tooltip tip="I'm here!" position="right">  Hover me</Tooltip>::tooltip[Hover me]{tip="I'm here!" position="top"}::tooltip[Hover me]{tip="I'm here!" position="bottom"}::tooltip[Hover me]{tip="I'm here!" position="left"}::tooltip[Hover me]{tip="I'm here!" position="right"}Icon#
<span>You can get this template in <Icon name="mdi:github" />[GitHub](https://github.com/HPCesia/astral-halo)</span><span>This is an open source project <Icon name="mdi:open-source-initiative" /></span><span>A huge icon is here: <Icon name="mdi:alert-octagon" size="5em" /></span>:icon{name="mdi:github"}:icon{name="mdi:open-source-initiative"}:icon{name="mdi:alert-octagon" size="5em"}Ruby#
<Ruby pairs={[{base: "汉", text: "hàn"}, {base: "字", text: "zì"}]} /><Ruby pairs={[["漢", "ㄏㄢ"], ["字", "ㄗ"]]} /><Ruby base="漢字" text="からじ" />::rubyc{base="汉|字" text="hàn|zì"}::rubyc{base="漢|字" text="ㄏㄢ|ㄗ"}::rubyc{base="漢字" text="からじ"}Web Contents#
LinkCard#
Codeberg is a non-profit, community-led organization that aims to help free and open source projects prosper by giving them a safe and friendly home.
A blog template powered by Astro
 
 Astro builds fast content sites, powerful web applications, dynamic server APIs, and everything in-between.
<LinkCard url="https://codeberg.org/HPCesia" /><LinkCard  url="https://codeberg.org/HPCesia/AstralHalo"  title="Astral Halo"/><LinkCard  title="Astro"  description="The all-in-one web framework designed for speed."  favicon = "https://astro.build/favicon.svg"  image = "https://astro.build/og/astro.jpg"  url="https://astro.build/"/>::linkcard{url="https://codeberg.org/HPCesia"}::linkcard{url="https://codeberg.org/HPCesia/AstralHalo" title="Astral Halo"}::linkcard{title="Astro" description="The all-in-one web framework designed for speed." favicon="https://astro.build/favicon.svg" image="https://astro.build/og/astro.jpg" url="https://astro.build/"}tip
LinkCard’s preview data is fetched on build time, the output is static.
RepoCard#
<RepoCard repo="HPCesia/astral-halo" platform='github' /><RepoCard repo="HPCesia/AstralHalo" platform='forgejo' host='https://codeberg.org' icon='simple-icons:codeberg' /><RepoCard repo="gitea/awesome-gitea" platform='gitea' host='https://gitea.com' icon='simple-icons:gitea' />