| Crates.io | dioxus_components |
| lib.rs | dioxus_components |
| version | 0.1.2 |
| created_at | 2025-11-12 04:21:28.40762+00 |
| updated_at | 2025-11-18 04:30:34.688284+00 |
| description | A comprehensive collection of reusable Dioxus 0.7 components built with Tailwind CSS v4 |
| homepage | |
| repository | https://github.com/LeTri234/dioxus_component |
| max_upload_size | |
| id | 1928817 |
| size | 627,066 |
A comprehensive collection of reusable Dioxus 0.7 components built with Tailwind CSS v4 and following Radix UI design patterns.
✨ 11 High-Quality Components
🎨 Styling
♿ Accessibility
⚠️ Important: Tailwind must be configured to scan the library source code, otherwise utility classes (like
size-12,px-4, etc.) won't be generated. See Step 2 below.
Add to your Cargo.toml:
[dependencies]
dioxus_components = "0.1.2"
dioxus = { version = "0.7.1", features = ["web"] }
Or add with cargo:
cargo add dioxus_components
⚠️ Critical Step: The components use Tailwind utility classes that must be included in your CSS build.
Download the safelist file:
curl -o safelist.json https://raw.githubusercontent.com/LeTri234/dioxus_component/main/safelist.json
Add to your tailwind.config.js:
module.exports = {
content: ["./src/**/*.{rs,html}"],
safelist: require("./safelist.json"),
theme: { extend: {} },
plugins: [],
};
Update your tailwind.css:
@import "tailwindcss";
@source "../src";
@source "../../.cargo/registry/src/*/dioxus_components-*/src";
Update your tailwind.config.js:
const path = require("path");
const os = require("os");
module.exports = {
content: [
"./src/**/*.{rs,html}",
path.join(
os.homedir(),
".cargo/registry/src/*/dioxus_components-*/src/**/*.rs"
),
],
theme: { extend: {} },
plugins: [],
};
Download the animations CSS:
curl -o src/components.css https://raw.githubusercontent.com/LeTri234/dioxus_component/main/src/components.css
Import in your tailwind.css:
@import "./components.css";
What's Included:
Note: The CSS file only contains custom animations. Step 2 above is required to generate utility classes like size-12, px-4, etc.
What's included:
Note: Components like Avatar, Badge, Button, Card, Dialog, Empty, and Portal use only Tailwind utility classes and don't require additional CSS.
📚 See detailed CSS setup guide for more import options and troubleshooting.
use dioxus::prelude::*;
use dioxus_components::{Button, ButtonVariant, Spinner, SpinnerSize};
#[component]
fn App() -> Element {
rsx! {
div {
class: "flex gap-4",
Button {
variant: ButtonVariant::Default,
"Click me"
}
Spinner {
size: SpinnerSize::Large,
color: "text-primary"
}
}
}
}
See COMPONENTS.md for detailed documentation and API references for all components.
Build the library:
cargo build --lib
Run the demo application:
dx serve --example demo
This will start a development server with hot reloading and open the demo in your browser.
Deploy the demo to Vercel in 3 steps:
Push to GitHub:
git push origin main
Import to Vercel:
vercel.jsonDeploy:
https://your-project.vercel.appSee DEPLOYMENT.md for detailed deployment instructions and alternative methods.
src/
├── lib.rs # Library entry point
├── components/ # All reusable components
│ ├── accordion/
│ ├── avatar/
│ ├── badge/
│ ├── button/
│ ├── card/
│ ├── checkbox/
│ ├── dialog/
│ ├── empty/ # NEW: Empty component
│ ├── portal/
│ ├── spinner/
│ └── tooltip/
└── utils/ # Utility functions
examples/
└── demo.rs # Demo application
COMPONENTS.md # Full component documentation
This project is configured as a Rust library that can be:
The library exports all components and utilities:
pub use dioxus_components::{
Accordion, AccordionItem, AccordionTrigger, AccordionContent,
Avatar, AvatarImage, AvatarFallback,
Badge, BadgeVariant,
Button, ButtonVariant, ButtonSize,
Portal, // NEW: Portal component
Spinner, SpinnerSize,
Tooltip, TooltipTrigger, TooltipContent, TooltipProvider,
cn, // utility function
};
This library is published and available on crates.io.
Install it in your project:
cargo add dioxus_components
Or manually add to Cargo.toml:
[dependencies]
dioxus_components = "0.1"
Update colors in your tailwind.css:
@theme {
--color-primary: hsl(221.2 83.2% 53.3%);
--color-secondary: hsl(210 40% 96.1%);
--color-destructive: hsl(0 84.2% 60.2%);
}
All components support the class prop:
Button {
class: "rounded-full px-6 py-3 text-lg",
"Custom button"
}
Build the library:
cargo build --lib
Run tests:
cargo test --lib
Generate documentation:
cargo doc --lib --open
MIT
cn utility for class merging