| Crates.io | shadcn-rust |
| lib.rs | shadcn-rust |
| version | 0.0.23 |
| created_at | 2025-08-29 12:48:31.882751+00 |
| updated_at | 2025-09-02 05:59:50.468989+00 |
| description | shadcn-style CLI for Rust (dioxus, leptos, yew, sycamore) |
| homepage | https://shadcn-rust.com |
| repository | https://github.com/codegress-com/shadcn-rust |
| max_upload_size | |
| id | 1815796 |
| size | 117,068 |
⚠️ DEVELOPMENT WARNING ⚠️
This package is currently under active development and not ready for production use. APIs, commands, and functionality may change significantly between versions. Use at your own risk and expect breaking changes.
A command-line tool for adding beautiful UI components to Rust web applications. Inspired by shadcn/ui, this CLI works with Dioxus, Leptos, Yew, and Sycamore frameworks.
cargo install shadcn-rust
Initialize your project:
shadcn-rust init
List available components:
shadcn-rust list
Add components to your project:
shadcn-rust add button card
Verify your setup:
shadcn-rust doctor
initInitialize a new project with component configuration.
shadcn-rust init [OPTIONS]
Options:
--framework <FRAMEWORK> - Target framework: dioxus, leptos, yew, or sycamore--theme <THEME> - UI theme: default or new-york--base-color <COLOR> - Base color scheme: slate, gray, zinc, neutral, or stone--skip-tailwind - Skip Tailwind CSS setup--yes - Skip interactive prompts and use defaults--config <FILE> - Configuration file path (default: components.json)Examples:
# Interactive setup
shadcn-rust init
# Non-interactive with specific options
shadcn-rust init --framework dioxus --theme default --base-color slate --yes
# Skip Tailwind setup
shadcn-rust init --framework leptos --skip-tailwind
listList all available components for your framework.
shadcn-rust list [OPTIONS]
Options:
--config <FILE> - Configuration file path (default: components.json)Example:
shadcn-rust list
addAdd one or more components to your project.
shadcn-rust add <COMPONENTS>... [OPTIONS]
Arguments:
<COMPONENTS>... - Names of components to addOptions:
--force - Overwrite existing components--export - Add component exports to module files--config <FILE> - Configuration file path (default: components.json)Examples:
# Add a single component
shadcn-rust add button
# Add multiple components
shadcn-rust add button card dialog
# Add with export and force overwrite
shadcn-rust add button --export --force
doctorDiagnose your project configuration and environment.
shadcn-rust doctor [OPTIONS]
Options:
--config <FILE> - Configuration file path (default: components.json)Example:
shadcn-rust doctor
The CLI uses a components.json file to store project configuration:
{
"$schema": "https://shadcn-rust.com/schema.json",
"framework": "dioxus",
"style": "default",
"tailwind": {
"base_css": "tailwind.base.css",
"output": "assets/tailwind.css",
"baseColor": "slate"
},
"aliases": {
"components": "src/components",
"ui": "src/components/ui",
"utils": "src/utils/shadcn",
"hooks": "src/hooks"
},
"registry": "https://shadcn-rust.com/registry"
}
framework: The target Rust web framework (dioxus, leptos, yew, sycamore)style: UI style variant (default)tailwind.output: Where compiled Tailwind CSS should be writtentailwind.baseColor: Base color scheme for componentsaliases: Directory mappings for different component typesregistry: Component registry URLassets/tailwind.css.rs filesstyles/tailwind.cssstyles/tailwind.cssstyles/tailwind.cssAfter initialization, your project will have this structure:
your-rust-app/
├── components.json # CLI configuration
├── src/
│ ├── components/
│ │ ├── ui/ # UI components from registry
│ │ └── mod.rs
│ ├── utils/
│ │ └── shadcn/ # Utility functions
│ └── hooks/ # Custom hooks (if applicable)
├── assets/ # (Dioxus) or styles/ (others)
│ └── tailwind.css # Compiled Tailwind CSS
└── tailwind.config.js # Tailwind configuration
Components are fetched from the official Shadcn-Rust registry at https://shadcn-rust.com/registry. The registry contains:
The CLI automatically sets up Tailwind CSS for your project:
tailwind.config.js with framework-specific content paths/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{rs,html}", "./src/**/*.rs"],
theme: {
extend: {
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
// ... more color definitions
},
},
},
plugins: [],
};
All commands support these global options:
--config <FILE> - Specify a custom configuration file path (default: components.json)--yes - Skip interactive prompts and use default values--help - Show help information--version - Show version informationshadcn-rust init from your project rootcomponents.json point to valid directoriesUse the doctor command to diagnose configuration issues:
shadcn-rust doctor
This will check:
# Initialize with Dioxus framework
shadcn-rust init --framework dioxus --theme default --base-color slate
# Add some common components
shadcn-rust add button card dialog
# Verify everything is working
shadcn-rust doctor
# List what's available
shadcn-rust list
# Add specific components with exports
shadcn-rust add table dropdown-menu --export
# Force overwrite existing component
shadcn-rust add button --force
# Set up project without prompts
shadcn-rust init --framework leptos --yes
# Add components in batch
shadcn-rust add button card table --export --yes
MIT © Codegress / Contributors