shadcn-rust 0.0.13

shadcn-style CLI for Rust (dioxus, leptos, yew, sycamore)
shadcn-rust-0.0.13 is not a library.

shadcn-rust

A shadcn-style CLI for Rust UI frameworks (Dioxus, Leptos, Yew, Sycamore).
It copies ready-made components from a registry into your app, writes a project component.json, and optionally prepares a minimal Tailwind setup.

  • Works with a local monorepo registry (apps/www/registry) or a remote git registry (cached clone).
  • Themes (Tailwind CSS presets) are resolved the same way (local → git fallback).

Features

  • init – interactive project setup (framework, aliases, Tailwind paths).
  • list – list available components for the selected framework.
  • add – copy components from the registry into your project.
  • doctor – environment & configuration checks.
  • Automatic registry resolution: local → git cache.
  • Automatic themes resolution: local → git cache.

Requirements

  • Rust 1.75+ (stable recommended).
  • Git (if you want to use the remote registry/themes).

Install

From source (this repo)

cargo install --path .

From crates.io (once published)

cargo install shadcn-rust

How it finds the Registry & Themes

  1. Local (preferred): walks up from current dir to find:
apps/www/registry/
apps/www/themes/
  1. Remote Git (fallback): clones and caches:
https://github.com/codegress-com/shadcn-rust

Cached under your OS cache, e.g.:

~/.cache/shadcn-rust/repo/
└─ apps/www/
   ├─ registry/
   └─ themes/

Quick Start

# 1) Initialize (creates components.json; Tailwind optional)
shadcn-rust init --framework dioxus

# 2) List available components
shadcn-rust list

# 3) Add components
shadcn-rust add button card --export

# 4) Check setup
shadcn-rust doctor

Non-interactive mode:

shadcn-rust init --framework leptos --yes

Commands

init

shadcn-rust init [--framework dioxus|leptos|yew|sycamore] [--skip-tailwind] [--yes]
  • Creates/updates component.json.
  • Prompts for framework and aliases unless provided.
  • Generates Tailwind files if enabled.

list

shadcn-rust list

Lists components available for your framework.

add

shadcn-rust add <component>... [--force] [--export]
  • --force overwrites existing.
  • --export adds pub mod ...; to mod.rs.

doctor

shadcn-rust doctor

Checks config, registry, and themes.


component.json example

{
  "$schema": "https://codegress.com/shadcn-rust/schema.json",
  "framework": "dioxus",
  "style": "default",
  "tailwind": {
    "config": "tailwind.config.js",
    "css": "src/tailwind.css",
    "baseColor": "slate"
  },
  "aliases": {
    "components": "src/components",
    "utils": "src/utils/shadcn",
    "ui": "src/components/ui",
    "hooks": "src/hooks"
  },
  "registry": "apps/www/registry"
}

Local Registry/Themes

If you have:

your-project/
├─ apps/www/
│  ├─ registry/
│  └─ themes/
└─ app/   # your Rust app

The CLI resolves them automatically.


Git Registry/Themes

Without local apps/www/, the CLI clones:

https://github.com/codegress-com/shadcn-rust

into your OS cache.


Tailwind configuration

When init sets up Tailwind:

  • src/tailwind.css is created from:

    • registry/<framework>/assets/tailwind.css, or
    • themes/default/tailwind.css (fallback).
  • tailwind.config.js is generated if missing:

/** Auto-generated by shadcn-rust */
module.exports = {
  content: ["./src/**/*.{rs,html}"],
  theme: {
    extend: {
      colors: {
        brand: require("tailwindcss/colors").slate,
      },
    },
  },
  plugins: [],
};

Change baseColor in component.json to switch the brand color.


License

MIT © Codegress / Contributors