Using with EmDash
The parts are plain Astro components. Use them in EmDash templates and pass them your content as props.
EmDash is a content management system that runs inside an Astro site: editors write in its admin, and your Astro pages read the entries. Astronomic UI works with it, but does not depend on it. Every part is a plain Astro component that takes props, so it works the same in a plain Astro site and in an EmDash site.
Plain Astro first
No part imports EmDash. @astronomic-dev/ui and @astronomic/ui-pro have no EmDash dependency, and a part never fetches content on its own.
The rule is simple: data in pages, looks in parts. Your page gets the content, from Markdown files, EmDash or any other source. Then it passes plain values (strings, lists, image URLs) to the parts. Change the source and the parts do not change.
Use parts in an EmDash template
An EmDash page is an Astro page. Read the entry in the frontmatter with EmDash's functions, then pass its fields to kit parts. This example assumes an EmDash site already set up: rendered on demand (output: "server" with an adapter) and a pages collection with entries in it.
---
// src/pages/[slug].astro
import { getEmDashEntry } from "emdash";
import { PortableText } from "emdash/ui";
import Hero from "@astronomic-dev/ui/components/Hero.astro";
import Prose from "@astronomic-dev/ui/components/Prose.astro";
const { slug = "" } = Astro.params;
const { entry: page } = await getEmDashEntry("pages", slug);
if (!page) return Astro.rewrite("/404");
---
<Hero heading={page.data.title} text={page.data.excerpt} />
<Prose>
<PortableText value={page.data.content} />
</Prose>The collection (pages) and the field names (title, excerpt, content) are examples: use the ones in your EmDash schema. For setting up EmDash itself, see the EmDash docs.
Pass content in
| Content | How to pass it |
|---|---|
| Text fields | As props: heading, text, label and the rest. Each part's page lists its props. |
| Lists (cards, links, logos) | Map the entries to the shape the part's prop asks for, such as { label, href } for actions. |
| Rich text | Render it with EmDash's PortableText inside Prose. Prose styles the plain HTML a rich-text renderer writes. |
| Images | Pass a URL and alt text to Media (src, alt). For EmDash's own responsive images, give Media your own image component with imageComponent. |
| Menus | Read the menu with EmDash, map its items to { label, href }, and pass them to Navbar as links. |
Tip
Astronomic themes already do this for you. Their pages read content through one content layer and pass plain props to the parts, so the same pages run on Markdown files or on EmDash. To switch a theme to EmDash, follow the setup notes in the theme's AGENTS.md: they cover seeding the content, picking the source in astro.config.mjs and running the server build.