Skip to content
Page

Getting Started

Install the Page theme, register it with Starlight, and render your first RefineUI component.

Page is a Starlight plugin. It replaces Starlight’s header, sidebar, search, table of contents, pagination, and footer with RefineUI, and it re-exports every RefineUI component so your pages can use the same parts.

Add the theme, the React integration, and React. @astrojs/starlight is already in a Starlight project.

bun add @pelagornis/page @astrojs/react react react-dom

The theme pulls in @refineui/react, @refineui/tokens, the icon font, and Tailwind. You don’t install them yourself.

astro.config.ts
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import pagePlugin from "@pelagornis/page";
export default defineConfig({
integrations: [
starlight({
title: "My Docs",
plugins: [
pagePlugin({
navigation: [{ href: "/guides/getting-started/", label: "Guide" }],
}),
],
}),
],
});

The plugin registers @astrojs/react and Tailwind for you. Don’t add react() to integrations a second time.

Option Type Use
navigation NavigationItem[] Items in the center of the header. A link, or a dropdown. See Header navigation.
footerText string Copyright line in the footer.
siteTitle string Brand text in the header. Defaults to the Starlight title.
breadcrumbs boolean Sidebar trail above each page title. Defaults to true.
llmsTxt boolean | { title?, description?, details? } Writes llms.txt for AI tools at build time. Defaults to true. See llms.txt.
skipComponents string[] Starlight slots that should keep the default Starlight component. See Shell overrides.

Each navigation item is a link or a dropdown. A dropdown lists items, or fills itself from a top-level sidebar group: name the group with sidebar, using the label as written in the Starlight config. A sidebar dropdown takes the group’s translated label, and lists the group’s pages and one link per nested group.

astro.config.ts
pagePlugin({
navigation: [
{ label: "Blog", href: "/blog/", translations: { ko: "블로그" } },
{ sidebar: "Guides" },
{
label: "Resources",
items: [
{ label: "Changelog", href: "/changelog/", description: "What changed in each release" },
{ label: "GitHub", href: "https://github.com/pelagornis/starlight-theme-page" },
],
},
],
});

Dropdown links take a short description for the second line, a string or one per locale lang. The panel grows with its text, as RefineUI’s NavigationMenu sets only a minimum width, so keep descriptions to a few words. A sidebar dropdown describes each nested group by its first two pages. translations holds labels per locale lang. Links that start with / get the current locale prefix on translated pages.

astro build writes three kinds of files for AI tools, from the rendered pages of the default locale:

  • /llms.txt: the project summary and every page in sidebar order, linked to its Markdown copy
  • /llms-full.txt: every page in one file
  • a Markdown copy of each page at its URL with .md in place of the trailing slash, such as /guides/getting-started.md

Code examples, tables, and every tab of a tab set are kept. Live component previews are left out. To ship your own llms.txt or llms-full.txt, put it in public/ and the plugin leaves it as it is. Set llmsTxt: false to turn the files off.

Terminal window
bun run dev

Open http://localhost:4321/. The header, sidebar, search (⌘ K), and footer are now RefineUI.

Every RefineUI component is exported from @pelagornis/page/components. Rename a page to .mdx and import what you need.

src/content/docs/index.mdx
---
title: Welcome
---
import { Badge, Button } from "@pelagornis/page/components";
<Badge variant="success">Stable</Badge>
<Button variant="primary">Continue</Button>

Components that only render markup work like this. Components that keep state, such as Tabs or Dialog, go in a .tsx file first. Use in MDX explains both cases, and Use in Markdoc covers .mdoc pages.

The plugin injects the stylesheets the shell needs. A separate global.css import is not required.

  • The @pelagornis/page Tailwind entry with the RefineUI token theme
  • The RefineUI system icon font
  • @refineui/react/refineui.css
  • Chrome rules that map Starlight’s layout variables onto RefineUI tokens

Light and dark mode follow Starlight’s theme switch. RefineUI semantic tokens change with data-theme, so components and your own CSS that uses var(--refineui-color-alias-*) follow along.