Skip to content
GitHub11 stars

Use the CLI to add components to your project.

The CLI is a .NET tool on NuGet. dnx, which comes with the .NET 10 SDK, runs it without installing it, the way npx does for npm packages.

dnx Blazix.Cli --version

To pin a version for a repository instead, install it as a local tool. Then run it as dotnet blazix:

dotnet new tool-manifest
dotnet tool install Blazix.Cli
dotnet blazix add button

init

Use the init command to set up a new or existing Blazor project.

The init command sets up Tailwind (without Node.js), adds the theme tokens and the usings, adds the Blazix.Primitives package and the icon package for the set in iconLibrary, and writes blazix.json. See Installation for each change it makes.

dnx Blazix.Cli init

Options

Usage: blazix init [options]

Options:
  -p, --project <path>   the project to set up, when the folder has more than one
  --dir <folder>         where components go (default: "Components/UI")
  --rtl                  copy components right-to-left ready ("rtl": true)
  --icon-library <name>  the icon set the components draw their icons from (default: lucide)
                         lucide, tabler, hugeicons, phosphor, remixicon, fontawesome
  --skip-package         don't add the Blazix.Primitives or icon package

Running init again updates the build files and the vendored CSS. It never overwrites Styles/theme.css or Styles/app.css, which are yours.

add

Use the add command to add components to your project. It also adds the components they depend on, and the packages they use: Blazix.Primitives, and the icon package for your iconLibrary.

dnx Blazix.Cli add [component...]

Options

Usage: blazix add <component...> | --all [options]

Options:
  -p, --project <path>   the project to add to, when the folder has more than one
  -a, --all              add every component, with the dependencies they need
  --overwrite            replace files you already have
  --skip-package         don't add the Blazix.Primitives or icon package

A file you already have is kept, unless you pass --overwrite. Run diff first to see what it would change. A copy from an earlier version draws its icons inline, as SVG: add --overwrite replaces it with one that uses <Icon>s from your iconLibrary. To add every component, pass --all, as shadcn's add --all does.

diff

Use the diff command to see what add --overwrite would change before you run it. With no components, it says whether each one you've added still matches this version's. With components, it shows the changes to their files as a diff, where - lines are yours and + lines are the version's.

dnx Blazix.Cli diff [component...]

Options

Usage: blazix diff [component...] [options]

Options:
  -p, --project <path>   the project, when the folder has more than one

It keeps no record of what was copied, so a line you edited shows as a change, just as an upstream change does. Read the diff before you overwrite.

migrate rtl

Use migrate rtl to make components you've already added right-to-left ready, and set "rtl": true so later adds come that way. See RTL.

dnx Blazix.Cli migrate rtl [path]

Options

Usage: blazix migrate rtl [path] [options]

Arguments:
  path                   a file or folder to migrate (default: componentsDir)

Options:
  -p, --project <path>   the project, when the folder has more than one
  -y, --yes              migrate again when "rtl" is already true

Run it once: a second run adds the rtl: classes again. Without a path, it migrates the files in componentsDir.

migrate icons

Use migrate icons to move the icons of components you've already added to another library, install its package, and set iconLibrary so later adds match. See Icons.

dnx Blazix.Cli migrate icons --to tabler

Options

Usage: blazix migrate icons [path] [options]

Arguments:
  path                   a file or folder to migrate (default: componentsDir)

Options:
  --from <library>       the library the icons come from (default: iconLibrary)
  --to <library>         the library to migrate to (asked for when omitted; must differ from --from)
  -y, --yes              migrate without the confirmation
  -p, --project <path>   the project, when the folder has more than one

It asks for each library you don't pass, then asks you to confirm before it writes. --yes skips the confirmation. The two libraries have to differ. It moves the <Icon>s of the components you've added, and lists each icon with no equivalent in the new library by name, leaving it as it is. A copy from an earlier version draws its icons inline, as SVG, and is not changed: add the component again with --overwrite. Without a path, it migrates the files in componentsDir; with one, it leaves blazix.json alone.

list

Use the list command to see the components you can add. The ones you've added are marked.

dnx Blazix.Cli list