For AI agents: the documentation index is at /llms.txt, and any docs page is available as Markdown by appending .md to its URL.
Set up Shelf in a Next.js project.
Create a project
Skip this if you already have a Next.js project. This site runs on Next with Shelf, so the steps below are the ones it uses.
Set up StyleX
Next compiles StyleX with Babel and writes the CSS with PostCSS. Add babel.config.js:
Add postcss.config.js, reusing the same Babel plugins:
Add the @stylex directive where the generated CSS should go, once, in the stylesheet your root layout imports.
A babel.config.js makes Next use Babel instead of SWC for your source, so builds are somewhat slower.
Install the CLI
The package is @shelfui/cli and its command is shelf.
Initialize Shelf
Writes shelf.config.json and .shelf/lock.json, copies the path aliases from your tsconfig.json, and adds a short agent block to AGENTS.md and a Shelf skill to .agents/skills/shelf/. It warns about anything missing from the StyleX setup above.
Add components
Copies Button, the foundations it uses, and the packages it needs into your project, then records what it installed. The files are yours to edit. See ownership and provenance.
Check the result
Verifies config, provenance, and imports. Your own build still covers the rest. See validation.
Use a component
Interactive components ship with "use client" where they need it, so you can import them from server components. For fonts, Shelf reads --font-sans and --font-mono, which works with next/font. See installation.