Installation
Start a new application on the Silkware Design System, from an empty folder to a build that passes.
This page takes you from an empty folder to a Next.js application that uses the Silkware theme and components. It uses the shadcn CLI on the React Aria base and installs everything from the Silkware registry. The code is copied into your project, so you own it from the first command.
Prerequisites
- Node.js 20 or later and pnpm. The commands below use
pnpm dlx; replace it withnpxorbunxif you use another package manager. - The registry is reachable. This documentation site serves it at
/r/{name}.json. Locally that ishttp://localhost:3000/r/{name}.json; in production it is the site URL you host it at. The examples below use the local address.
Install
Create the project
Run
initwith the Next.js template and the React Aria base. Thevegapreset gives you thearia-vegastyle that Silkware components are written for.pnpm dlx shadcn@latest init --template next --base aria --preset vega --name my-appcd my-appAdd the registry
Register the
@silkwarenamespace incomponents.json.pnpm dlx shadcn@latest registry add "@silkware=http://localhost:3000/r/{name}.json"The command adds one line to
components.json:{ "registries": { "@silkware": "http://localhost:3000/r/{name}.json" }}Install the theme
The theme item is the whole
app/globals.cssof Silkware: colours for light and dark, the type scale, radius, shadows, motion, base rules and the font faces. It replaces the file thatinitwrote, so it needs--overwrite.pnpm dlx shadcn@latest add @silkware/theme --overwriteThe theme also installs Typeset:
app/typeset.css, imported byglobals.cssright after Tailwind. Its presets are inglobals.css. Rendered text, such as Markdown from an agent or an article, is styled by wrapping it in atypesetcontainer with a preset, for exampletypeset typeset-docs.Copy the fonts
globals.cssloads Mona Sans and Noto Sans SC from/fonts/. Font files are binary and a registry item can only carry text, so you copy them once intopublic/fonts. They are then served by your own application, with no request to another host at run time.mkdir -p public/fontscurl -o public/fonts/mona-sans.woff2 http://localhost:3000/fonts/mona-sans.woff2curl -o public/fonts/noto-sans-sc.woff http://localhost:3000/fonts/noto-sans-sc.woffinitalso loads Inter and Geist Mono throughnext/fontinapp/layout.tsx. The theme sets its own font tokens, so you can remove those imports and their class names from the layout.Add components
Name the items you need. Dependencies, hooks and helpers come with them.
pnpm dlx shadcn@latest add @silkware/button @silkware/field @silkware/dialog @silkware/sidebar @silkware/menubar @silkware/code-block --overwrite--overwritereplaces thebutton.tsxthatinitcreated with the Silkware one. Add AI patterns the same way:pnpm dlx shadcn@latest add @silkware/ai-chat @silkware/ai-toolVerify
Import a component, then check the types and the build.
import { Button } from "@/components/ui/button" export default function Page() { return <Button>Approve order</Button>}pnpm typecheckpnpm buildOpen the page. Text should be set in Mona Sans on a white ground, with an ink button.
What changed in your project
| Path | Written by |
|---|---|
components.json | The registry add command: the @silkware namespace. |
app/globals.css | @silkware/theme. |
app/typeset.css | @silkware/typeset, installed with the theme. |
public/fonts/ | The two curl commands. |
components/ui/ | Each component you add. |
components/ai-elements/ | Each AI pattern you add. |
hooks/, lib/ | Hooks and helpers that components need, such as use-mobile and highlighter. |
package.json | The npm packages that the items import. |