Dioxus UI System
A pure Rust design system for Dioxus with Atomic Design principles. Build beautiful, type-safe user interfaces without touching CSS or JavaScript.
Features
- 🎨 Atomic Design Architecture: Components organized as Atoms, Molecules, and Organisms
- 🌗 Type-Safe Theming: Comprehensive theme system with light/dark/brand modes
- 🦀 Pure Rust Styling: No CSS files - all styles generated in Rust
- 🎯 Tailwind-like API: Fluent style builder for rapid UI development
- 📱 Multi-Platform: Works on Web (WASM), Desktop, and Mobile
- ⚡ Zero Runtime CSS: Inline styles for maximum performance
- 🔒 Type Safety: Catch styling errors at compile time
Quick Start
Add to your Cargo.toml:
[]
= "0.1"
= { = "0.6", = ["web"] }
Create your first UI:
use *;
use *;
Architecture
Atomic Design
Components are organized following Atomic Design principles:
Atoms → Buttons, Inputs, Labels, Icons
Molecules → InputGroup, Card, Badge
Organisms → Header, DataTable
Theme System
The theme system provides type-safe design tokens:
use ;
// Use preset themes
let light = light;
let dark = dark;
// Create custom brand theme
let brand = brand;
Style Builder
Build styles with a fluent, Tailwind-like API:
use Style;
use use_theme;
Components
Atoms
Button
use ;
rsx!
Variants: Primary, Secondary, Ghost, Destructive, Link
Sizes: Sm, Md, Lg, Icon
Input
use ;
let mut value = use_signal;
rsx!
Label
use ;
rsx!
Icon
use ;
rsx!
Built-in icons: check, x, plus, minus, arrow-left/right/up/down, chevron-*, menu, search, user, settings, home, bell, heart, star, trash, edit, copy, external-link, loading, info, warning, alert, error, moon, sun
Molecules
Card
use ;
rsx!
InputGroup
use InputGroup;
rsx!
Badge
use ;
rsx!
Organisms
Header
use ;
let nav_items = vec!;
rsx!
Theming
Theme Provider
Wrap your app with the ThemeProvider:
rsx!
Accessing Theme
use use_theme;
Custom Themes
use ;
let mut theme = light;
theme.colors.primary = new; // Purple
theme.colors.primary_foreground = new;
// Or use brand helper
let brand_theme = brand;
Multi-Platform Support
The library supports Web, Desktop, and Mobile via feature flags:
[]
= { = "0.1", = false, = ["web"] }
# or
= { = "0.1", = false, = ["desktop"] }
# or
= { = "0.1", = false, = ["mobile"] }
Examples
Run the example app:
# Web
&&
# Desktop
&&
# Mobile (requires setup)
&&
Project Structure
dioxus-ui-system/
├── Cargo.toml
├── src/
│ ├── lib.rs # Main library entry
│ ├── theme/ # Theme system
│ │ ├── tokens.rs # Design tokens
│ │ ├── context.rs # Theme context & provider
│ │ └── mod.rs
│ ├── styles/ # Styling system
│ │ ├── builder.rs # Style builder
│ │ └── mod.rs
│ ├── atoms/ # Atomic design atoms
│ │ ├── button.rs
│ │ ├── input.rs
│ │ ├── label.rs
│ │ ├── icon.rs
│ │ └── mod.rs
│ ├── molecules/ # Atomic design molecules
│ │ ├── input_group.rs
│ │ ├── card.rs
│ │ ├── badge.rs
│ │ └── mod.rs
│ └── organisms/ # Atomic design organisms
│ ├── header.rs
│ ├── data_table.rs
│ └── mod.rs
└── example-app/ # Example application
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT OR Apache-2.0 license.