Install components as local source via the shadcn CLI for full customization.
OUI ships two distribution channels. The npm package (@opengovsg/oui) is canonical and governed. The registry channel lets you install any component as local source you fully own — useful when you need a one-off variant that can't be merged upstream.
You need Tailwind CSS v4 configured.
In a fresh project (or any project without a components.json), run:
pnpm dlx shadcn@latest init https://oui.open.gov.sg/r/oui.jsonThis writes a components.json configured for OUI — aliasing ui to @/components/oui and utils to @/lib/oui/cn — and installs @opengovsg/oui-theme plus the shared cn utility. Passing the URL as a positional argument bypasses shadcn's interactive base and preset prompts.
Then import the OUI base CSS in your global stylesheet:
/* globals.css */
@import "tailwindcss";
@import "@opengovsg/oui-theme/base.css";pnpm dlx shadcn@latest add https://oui.open.gov.sg/r/button.jsonThe CLI:
components/oui/ directory.lib/oui/ directory.cn, tv, variants utilities).You can chain the two steps in one command:
pnpm dlx shadcn@latest init https://oui.open.gov.sg/r/oui.json https://oui.open.gov.sg/r/button.jsonThe file lives in your repo. We do not push updates to it. When OUI ships a fix:
@opengovsg/oui changelog records the change. Watch it for fixes that affect components you've pulled.npx shadcn diff https://oui.open.gov.sg/r/<name>.json.shadcn add again. The CLI will prompt before overwriting.We do not maintain backward-compatible manifests across major OUI versions. The registry URL is always current.
The changelog describes the npm package's behavior. Most fixes apply identically to the registry-installed copy, but some (e.g., changes to internal export shapes) won't matter because the transformer rewrites those away. When in doubt, shadcn diff.
A machine-readable index of every registry item is at https://oui.open.gov.sg/r/index.json.