Documentation
Registry
Install Fragments UI as verified source. Governance checks the lockfile against the published artifact.
For governed Cloud projects, install from a registry artifact so npx @usefragments/cli check can prove source matches the published version. Full flags live on /cli.
Install
Install the CLI, then set a Cloud API key:
npm install -D @usefragments/cli
export FRAGMENTS_API_KEY="fc_..."Pull every component and package entrypoint into the default target:
npx @usefragments/cli registry add --all \
--to src/fragments/ui \
--import-path "@/fragments/ui"That import path requires an @/* → src/* alias. For vanilla Vite, use --import-path "./fragments/ui" and relative imports from src/App.tsx.
The CLI discovers the hosted artifact from Fragments Cloud catalog metadata. Override only for local artifacts with --from or FRAGMENTS_UI_REGISTRY_ARTIFACT_URL.
Import styles once from the registry path:
import "@/fragments/ui/styles/globals.scss";
import { ThemeProvider, TooltipProvider, ToastProvider } from "@/fragments/ui";Commands
add
Install selected components, or everything with --all:
npx @usefragments/cli registry add --all --to src/fragments/ui --import-path "@/fragments/ui"
npx @usefragments/cli registry add Button Card --to src/fragments/uistatus
Inspect the lockfile and installed source state:
npx @usefragments/cli registry statusdiff
Compare installed source against a registry artifact:
npx @usefragments/cli registry diffsync
Refresh installed source using the existing lockfile selection:
npx @usefragments/cli registry syncmigrate
Convert an existing @usefragments/ui app to registry source. Preview first:
npx @usefragments/cli registry migrate --dry-run
npx @usefragments/cli registry migrateMigrate installs registry source, rewrites npm imports to @/fragments/ui, updates simple Next.js transpilePackages, and removes the npm UI package unless you pass --keep-package. See /cli.
Lockfile and drift
npx @usefragments/cli registry add writes source plus .fragments/registry-lock.json.
The lockfile pins the artifact version and file hashes so npx @usefragments/cli check can prove committed source still matches the registry.
Drift means local files no longer match the lockfile. Inspect with npx @usefragments/cli registry status and npx @usefragments/cli registry diff, then refresh with npx @usefragments/cli registry sync.
src/fragments/ui. Change selection or refresh through the registry commands above.Next steps
- Getting Started — providers, framework notes, theming
- CLI Reference — full registry flags and options
- Components — browse the component catalog