UIGetting startedReact
CLI
The registry is a set of JSON files at fixed addresses. shadcn's CLI reads them and writes the components into your app.
Add an item
In an app with a components.json (Installation writes one), pass an item's address to add. The file needs no entry for this registry: the address is the item's whole name. For React:
npx shadcn@4.23.0 add https://hamur.dev/r/react/<name>.jsonThe pinned version is the one the registry's proof runs. A SvelteKit app uses shadcn-svelte@1.8.0 instead, with the items under /r/shadcn-svelte/.
The Dialog, for example:
npx shadcn@4.23.0 add https://hamur.dev/r/react/dialog.jsonWhat the CLI does
- It reads
components.jsonfor the folders and import aliases, so a file lands where your app imports it from. - It fetches the item, then every item named in its
registryDependencies, each by its full address (the Dialog pullsutilsandbutton). - It writes each file with the registry's imports turned into your aliases, and installs the npm packages the item lists.
- The theme item writes no file: it adds its tokens, the
@theme inlinemapping and the base styles to the stylesheetcomponents.jsonnames.
Once written, the files are yours to change. Nothing tracks them afterwards except the version comment each one carries (Versions).
Addresses
Every file sits under https://hamur.dev/r/. <fw> is one of react, vue, svelte, angular and solid. These are the patterns this site serves, with an example of each:
| Address | Holds | Example | Files |
|---|---|---|---|
/r/<fw>/<name>.json | The item at its latest version, in shadcn’s registry-item schema. | /r/react/dialog.json | 615 |
/r/<fw>/<name>@<version>.json | The item at one version; the address never changes what it serves. | /r/react/dialog@0.1.2.json | 615 |
/r/<fw>/registry.json | The index of the framework’s items, without their file contents. | /r/react/registry.json | 5 |
/r/shadcn-svelte/<name>.json | The Svelte item in shadcn-svelte’s schema, at its latest version. | /r/shadcn-svelte/dialog.json | 123 |
/r/shadcn-svelte/<name>@<version>.json | The same, at one version. | /r/shadcn-svelte/dialog@0.1.2.json | 123 |
/r/<fw>/<name>.versions.json | Every version of the item with its hash, and which one is latest. | /r/react/dialog.versions.json | 615 |
Versions
Each item has a version, and every file it writes names it in a comment, such as hamur/ui dialog@0.1.2. The comment stays when you edit the file, so you know which version you started from. To add exactly that version again, use the address with @<version>; to see what is newer, read the item's versions.json (the React Dialog's, from /r/react/dialog.versions.json):
{
"name": "dialog",
"latest": "0.1.2",
"versions": [
{
"version": "0.1.0",
"hash": "4fcac03a28a1d7815e9cbc67af557e6400fe4435589e8bbbb88122be917d5aea",
"url": "https://hamur.dev/r/react/dialog@0.1.0.json"
},
{
"version": "0.1.1",
"hash": "4fcac03a28a1d7815e9cbc67af557e6400fe4435589e8bbbb88122be917d5aea",
"url": "https://hamur.dev/r/react/dialog@0.1.1.json"
},
{
"version": "0.1.2",
"hash": "7ef08e0aaad418681c5812d20aedabdb53676896ecb521f09dacd8e3c9e26221",
"url": "https://hamur.dev/r/react/dialog@0.1.2.json"
}
]
}
Behavior updates do not come through the CLI: they arrive with the headless package, by npm update.