The CLI ships as the @sveltery/ui package. Run it with npx, so you always get the latest version.
The CLI asks before it changes files. In a terminal that cannot answer prompts, such as CI, pass --yes. Without it, a command that needs an answer stops with No terminal to confirm in. Re-run with --yes.
init
Use the init command to set up an existing SvelteKit or Vite app. It writes components.json, adds the theme to your CSS file and installs the base packages.
init asks for a style, an icon library and a base color. Then it:
- writes
components.json. - adds the
tw-animate-cssand@sveltery/ui/tailwind.cssimports, thedarkcustom variant and the theme tokens to your CSS file. - installs
cn,class-variance-authority,tw-animate-cssand the icon package as dependencies, and@sveltery/uias a dev dependency, because your CSS imports itstailwind.css. - gives SvelteKit 3's
"#lib/*": "./src/lib/*"mapping inpackage.jsona./src/lib/*/index.jsfallback, so TypeScript resolves imports such as#lib/components/ui/button.
init needs Svelte 5, Tailwind CSS 4, and @sveltejs/kit or vite in package.json. It uses the CSS file from the --css flag, else tailwind.css in an existing components.json. Without either, it takes src/app.css or the first CSS file under src/, whichever first contains @import "tailwindcss".
Run init again at any time. A second run with the same choices leaves your files unchanged. With -y, it keeps the choices in your components.json.
To start from a preset, pass --preset. It takes a preset name such as nova, a preset code from the Create page, or the URL of an /init item. A preset sets the style, icon library, base color, theme, fonts, radius and menu look. Its fonts install as Fontsource packages.
--preset with no value lists the presets. Pick Custom to get a link to the Create page.
Options
Usage: sveltery init [options]
set up components.json, the theme and the base packages
Options:
-y, --yes use the defaults without prompting (default: false)
-p, --preset [preset] use a preset: a name such as nova, a preset code, or an
/init URL
--style <name> the component style
--icons <library> the icon library
--base-color <name> the base color of the theme
--css <path> the CSS file that imports Tailwind
--rtl enable RTL support
--no-rtl disable RTL support
--cwd <path> the project root (default: ".")
--no-install do not install packages
-h, --help display help for command --preset cannot be combined with --style, --icons or --base-color. With -y and no value, --preset uses nova.
--rtl writes rtl: true to components.json, so add turns physical classes into logical ones. It works with or without --preset. See RTL.
add
Use the add command to add components and their dependencies to your project.
add fetches each item and the items it depends on. It shows the files it will write and the packages it will install, then asks you to continue. Files go to the aliases.ui directory in components.json, which is src/lib/components/ui by default.
If a file already exists and differs, add asks before it overwrites it. It skips identical files.
An argument that is a URL is fetched as is. Use it to add an item from your own registry.
Options
Usage: sveltery add [options] [items...]
add components to the project
Arguments:
items item names, or URLs of registry items
Options:
-y, --yes do not ask to continue; changed files are skipped unless
--overwrite is set (default: false)
-o, --overwrite overwrite changed files (default: false)
-a, --all add every item (default: false)
--dry-run show the plan and stop (default: false)
--no-install do not install packages
--cwd <path> the project root (default: ".")
-h, --help display help for command --dry-run prints the plan and writes nothing. Each file has a mark: + for a new file, ~ for a file that differs and = for an identical one.
Files:
+ src/lib/components/ui/button/Button.svelte (new)
+ src/lib/components/ui/button/index.ts (new)
+ src/lib/components/ui/button/types.ts (new)
+ src/lib/components/ui/button/variants.ts (new)
Packages:
@sveltery/base@^0.2.0 diff
Use the diff command to see how the registry versions of your installed items differ from your files. It never writes anything.
An item counts as installed when any of its files exists under aliases.ui. With no names, diff checks every installed item and the items they depend on. A named item that is not installed is an error.
diff prints a unified diff for each file that differs. Your file is the a/ side and the registry version is the b/ side, so + lines are what update would write. It ends with a count such as 3 files differ in 2 items, or Everything is up to date.
Options
Usage: sveltery diff [options] [items...]
show how the registry versions of installed items differ from your files
Arguments:
items item names; every installed item when omitted
Options:
--cwd <path> the project root (default: ".")
-h, --help display help for command update
Use the update command to apply registry changes to your installed items.
update plans the same files as add, including new files, new items an item now depends on and missing packages. For each changed file, it shows the diff and asks whether to overwrite it. The default answer is no. It writes new files without asking.
Options
Usage: sveltery update [options] [items...]
re-add installed items, showing each changed file's diff and asking before it
overwrites
Arguments:
items item names; every installed item when omitted
Options:
-y, --yes overwrite changed files without asking (default: false)
--no-install do not install packages
--cwd <path> the project root (default: ".")
-h, --help display help for command -y discards your edits to the changed files.
diff and update take item names only. They do not check items that you added by URL.
view
Use the view command to print registry items as JSON. It never writes anything and needs no components.json.
view prints one JSON array with an object for each argument, in the order you gave them. Each object is the item as the registry serves it, with the content of its files. It does not fetch the items they depend on. An argument is an item name, or the URL of an item.
The item name resolves in the style from components.json, or nova when there is none. The registry is SVELTERY_REGISTRY_URL, else the registry key of components.json, else the Sveltery registry.
Options
Usage: sveltery view [options] <items...>
view items from the registry
Arguments:
items item names, or URLs of registry items
Options:
--cwd <path> the project root (default: ".")
-h, --help display help for command list
Use the list command to see every item in the registry. Items in your project are marked installed.
accordion registry:ui
alert registry:ui
alert-dialog registry:ui Pass --json for an array of { name, type, installed }.
Options
Usage: sveltery list [options]
list the registry's items and mark the installed ones
Options:
--json print the items as JSON (default: false)
--cwd <path> the project root (default: ".")
-h, --help display help for command migrate
Use the migrate command to run a migration on your project.
Available migrations
Options
Usage: sveltery migrate [options] [migration] [path]
run a migration
Arguments:
migration the migration to run
path a file, directory or glob pattern to migrate; the ui directory
when omitted
Options:
-l, --list list all migrations (default: false)
-y, --yes skip the confirmation prompt (default: false)
--cwd <path> the project root (default: ".")
-h, --help display help for command migrate rtl
The rtl migration rewrites the components you already installed for right-to-left layouts.
It sets rtl: true in components.json, then changes physical classes such as ml-2 and left-0 to logical ones such as ms-2 and start-0 in each file. Pass a file, a directory or a glob pattern with * to migrate only those files. A glob needs Node 22 or later.
It skips a file it cannot parse, with a warning, and lists the calendar, pagination and sidebar files it finds for you to check by hand. The icons that add would flip lose their flip marker when an LTR project adds them, so run update afterwards to get them back. See Manual Migration.
Environment variables
SVELTERY_REGISTRY_URL sets the registry root, for example a preview deploy's /r URL. It takes precedence over the registry key in components.json. init writes the URL it used to that key.
SVELTERY_REGISTRY_URL=https://preview.example.com/r npx @sveltery/ui@latest add button Not supported
The shadcn CLI has commands and options that this CLI does not have yet: apply, preset, search, build, docs, info and eject, the cn, icons, base-color and radix migrations, namespaced registries, local file paths as items and JavaScript output. See Registry and JavaScript for what works today.