# Dioxus Element Plus
<a href="https://github.com/pauljohn21/dioxus-element-plug">
<img src="https://img.shields.io/github/stars/pauljohn21/dioxus-element-plug?style=social" alt="GitHub stars">
<img src="https://img.shields.io/github/forks/pauljohn21/dioxus-element-plug?style=social" alt="GitHub forks">
<img src="https://img.shields.io/github/issues/pauljohn21/dioxus-element-plug" alt="GitHub issues">
<img src="https://img.shields.io/github/license/pauljohn21/dioxus-element-plug" alt="GitHub license">
</a>
Element UI components for Dioxus applications with pure Rust styling system.
<a href="https://crates.io/crates/dioxus-element-plug">
<img src="https://img.shields.io/crates/v/dioxus-element-plug.svg" alt="Crates.io version">
<img src="https://img.shields.io/crates/d/dioxus-element-plug.svg" alt="Crates.io downloads">
<img src="https://img.shields.io/crates/l/dioxus-element-plug.svg" alt="Crates.io license">
</a>
<a href="https://docs.rs/dioxus-element-plug">
<img src="https://docs.rs/dioxus-element-plug/badge.svg" alt="Documentation">
</a>
This crate provides a comprehensive set of UI components styled with the popular Element Plus design system, designed for use with Dioxus framework. All styling is generated in pure Rust for zero runtime overhead. **Hosted on GitHub: [pauljohn21/dioxus-element-plug](https://github.com/pauljohn21/dioxus-element-plug)**
## Features
- ๐จ **Pure Rust styling** - Zero runtime overhead with compile-time CSS generation
- ๐ฆ **Rust-native components** - Type-safe components built for Dioxus 0.7
- ๐ฆ **Ready to use** - Components work out of the box with proper styling
- ๐ฏ **Consistent API** - Intuitive props and events matching Dioxus patterns
- ๐ฑ **Responsive design** - Mobile-friendly components with flexible grid system
- ๐ฅ **Tree-shaking friendly** - Only include styles for components you use
- โก **Zero dependencies** - No SCSS compilation required at runtime
## Quick Start
๐ **ๆ็ฎๅ็ๅผๅงๆนๅผ**๏ผๅช้ 5 ๅ้ๅฐฑ่ฝๅๅปบ่ฟ่ก็ๅบ็จ๏ผ
ๅฎๆด็็ซฏๅฐ็ซฏ็คบไพ๏ผ่ฏท็ [SIMPLE_START.md](SIMPLE_START.md)ใ
### 1. Add to your Cargo.toml
For production use:
```toml
[dependencies]
dioxus = { version = "0.7", features = ["web"] }
dioxus-element-plug = "0.1.5"
```
Or use directly from GitHub:
```toml
dioxus-element-plug = { git = "https://github.com/pauljohn21/dioxus-element-plug.git" }
```
### 2. Generate Styles with Pure Rust
The modern approach uses pure Rust CSS generation for zero runtime overhead:
```rust
use dioxus_element_plug::CompleteStyleManager;
// Generate complete Element Plus styles
let styles = CompleteStyleManager::new().generate_complete_styles();
rsx! {
style { "{styles}" }
// Your components here
Button {
variant: ButtonVariant::Primary,
"Click me!"
}
}
```
#### Tree-Shaking Optimization
For optimized builds, generate styles only for components you use:
```rust
let styles = CompleteStyleManager::new()
.generate_styles_for_components(&["button", "input", "alert"]);
```
This approach eliminates unused CSS and produces smaller bundle sizes.
### 3. Use the components
```rust
use dioxus::prelude::*;
use dioxus_element_plug::{CompleteStyleManager, Button, ButtonVariant, Input, InputType, InputSize, Card, Row, Col};
fn App() -> Element {
// Generate styles for better performance
let styles = CompleteStyleManager::new().generate_complete_styles();
rsx! {
style { "{styles}" }
div {
style: "padding: 24px; background-color: #f5f7fa; min-height: 100vh;",
h1 { "My App" }
Card {
h2 { "Welcome!" }
Button {
variant: ButtonVariant::Primary,
"Click me!",
}
Input {
input_type: InputType::Text,
placeholder: "Enter text...",
size: InputSize::Medium,
}
}
Row {
Col { span: 12 {
p { "Full width column" }
}}
}
}
}
}
```
## Available Components
### Layout Components
- `Container`, `Header`, `Main`, `Footer` - Page layout structure
- `Row`/`Col` - Responsive grid system with 24-column layout
- `Layout` - Complete layout wrapper with sidebar support
### Form Controls
- `Button` - Multiple variants (primary, success, warning, danger, info)
- `Input` - Text, password, email inputs with validation states
- `Form`/`FormItem` - Form layout with labels and validation
- `Select` - Dropdown selection with search capabilities
- `Checkbox`/`Radio` - Boolean selection controls
- `Switch` - Toggle switches with custom labels
- `Slider` - Range input with real-time value display
### Data Display
- `Table` - Sortable, filterable data tables with pagination
- `Card` - Content containers with headers and shadows
- `Alert` - Status messages (success, warning, error, info)
- `Avatar` - User avatars with fallback support
- `Badge` - Notification badges and status indicators
### Navigation & Feedback
- `Menu` - Horizontal and vertical navigation menus
- `Tabs` - Tabbed content with dynamic loading
- `Breadcrumb` - Navigation breadcrumbs with icons
- `Pagination` - Table and list pagination controls
- `Message`/`Notification` - Toast-style temporary messages
## Component Examples
### Buttons
```rust
use dioxus_element_plug::{Button, ButtonVariant, ButtonSize};
rsx! {
div {
style: "display: flex; gap: 12px; flex-wrap: wrap;",
Button {
variant: ButtonVariant::Primary,
size: ButtonSize::Large,
"Large Primary"
}
Button {
variant: ButtonVariant::Success,
"Success"
}
Button {
variant: ButtonVariant::Warning,
"Warning"
}
Button {
variant: ButtonVariant::Danger,
"Danger"
}
Button {
variant: ButtonVariant::Info,
size: ButtonSize::Small,
"Small Info"
}
}
}
```
### Input Controls
```rust
use dioxus_element_plug::{Input, InputType, InputSize};
rsx! {
div {
style: "display: flex; flex-direction: column; gap: 16px; max-width: 400px;",
Input {
input_type: InputType::Text,
placeholder: "Full name",
size: InputSize::Large,
}
Input {
input_type: InputType::Password,
placeholder: "Password",
size: InputSize::Medium,
}
Input {
input_type: InputType::Email,
placeholder: "Email address",
size: InputSize::Medium,
}
}
}
```
### Grid Layout
```rust
use dioxus_element_plug::{Container, Header, Main, Footer, Row, Col};
rsx! {
Container {
Header {
height: 60,
h1 { "My App" }
}
Main {
Row {
style: "margin-bottom: 16px;",
Col { span: 12 {
div {
style: "background: #f0f9ff; padding: 20px; border-radius: 4px;",
"Column 1 (span=12)"
}
}}
Col { span: 12 {
div {
style: "background: #f0f9ff; padding: 20px; border-radius: 4px;",
"Column 2 (span=12)"
}
}}
}
Row {
Col { span: 8, offset: 8 {
div {
style: "background: #fff7e6; padding: 20px; border-radius: 4px;",
"Column with offset (span=8, offset=8)"
}
}}
}
}
Footer {
height: 60,
p { "Footer" }
}
}
}
```
### Form Controls
```rust
use dioxus_element_plug::{Form, FormItem, Input, InputType, Select, SelectOption};
rsx! {
Form {
FormItem {
label: "Email Address".to_string(),
required: true,
Input {
input_type: InputType::Email,
placeholder: "Enter your email",
}
}
FormItem {
label: "Country".to_string(),
Select {
options: vec![
SelectOption { value: "us".to_string(), label: "United States".to_string(), disabled: false },
SelectOption { value: "ca".to_string(), label: "Canada".to_string(), disabled: false },
SelectOption { value: "uk".to_string(), label: "United Kingdom".to_string(), disabled: false },
],
placeholder: "Select your country",
}
}
}
}
```
### Alerts
```rust
use dioxus_element_plug::{Alert, AlertType};
rsx! {
div {
style: "display: flex; flex-direction: column; gap: 12px;",
Alert {
title: "Success!".to_string(),
alert_type: AlertType::Success,
}
Alert {
title: "Warning!".to_string(),
alert_type: AlertType::Warning,
}
Alert {
title: "Error!".to_string(),
alert_type: AlertType::Error,
}
Alert {
title: "Info!".to_string(),
alert_type: AlertType::Info,
}
}
}
```
### Cards
```rust
use dioxus_element_plug::Card;
rsx! {
Card {
div {
h3 { "User Profile" }
div {
style: "display: flex; align-items: center; gap: 16px; margin-top: 16px;",
div {
style: "width: 60px; height: 60px; border-radius: 50%; background: #409eff; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold;",
"JD"
}
div {
h4 { "John Doe" }
p { "Software Developer" }
}
}
}
}
}
```
## Project Status
**๐ COMPLETE** - All 95+ components implemented with pure Rust styling!
- โ
95+ production-ready components
- โ
Complete Element Plus design system compatibility
- โ
Pure Rust CSS generation (zero runtime overhead)
- โ
Zero compilation errors, 269/269 tests passing
- โ
Modern Dioxus 0.7 integration
- โ
Production deployment ready
## Development
### Project Structure
```
dioxus-element-plus/
โโโ src/
โ โโโ components/ # 95+ production-ready components
โ โโโ styles/ # Complete CSS generation system
โ โโโ style_system.rs # Main style manager API
โโโ examples/
โ โโโ modern-pure-rust-example/ # Complete working example
โโโ Cargo.toml # Rust dependencies
โโโ README.md # This file
โโโ tests/ # Comprehensive test suite
```
### Modern Development Workflow
Since this is a complete, stable library, development focuses on:
- **Integration Testing**: Try the [modern example](examples/modern-pure-rust-example/)
- **Component Usage**: Import and use components in your Dioxus projects
- **Customization**: Override theme colors via the `Theme` system
### Theme Customization
Customize the theme using the built-in theme system:
```rust
use dioxus_element_plug::Theme;
// Create custom theme
let custom_theme = Theme::new()
.with_primary_color("#1890ff")
.with_font_size("16px");
// Generate styles with custom theme
let styles = CompleteStyleManager::new()
.with_theme(custom_theme)
.generate_complete_styles();
```
### Component Development Status
- โ
**95+ Components**: All major Element Plus components implemented
- โ
**Pure Rust Styling**: Zero runtime CSS compilation needed
- โ
**Type-Safe APIs**: Compile-time validation for all props
- โ
**Complete Documentation**: See docs.rs for detailed API docs
## License
MIT License - see LICENSE file for details.
## Community & Support
This project is complete and stable. Community engagement is welcome for:
### Bug Reports & Issues
- Report issues on [GitHub Issues](https://github.com/pauljohn21/dioxus-element-plug/issues)
- Check existing issues before creating new ones
- Include reproduction steps and environment details
### Feature Requests
- For new component requests, open a GitHub issue
- Discuss in [GitHub Discussions](https://github.com/pauljohn21/dioxus-element-plug/discussions)
- Check if similar features are already planned
### Getting Help
- Browse the [complete API docs](https://docs.rs/dioxus-element-plug)
- Study the [modern example](examples/modern-pure-rust-example/)
- Ask questions in GitHub Discussions
## Credits
- [Element Plus](https://element-plus.org/) - Modern design system and component library
- [Dioxus](https://dioxuslabs.com/) - Modern React-like framework for Rust
- [GitHub Contributors](https://github.com/pauljohn21/dioxus-element-plug/graphs/contributors) - Open source community
## License
MIT License - see LICENSE file for details.
## Star & Support
If you find this project helpful for your Dioxus applications, please consider:
- โญ [Star the Repository](https://github.com/pauljohn21/dioxus-element-plug)
- ๐ [Report Issues](https://github.com/pauljohn21/dioxus-element-plug/issues)
- ๐ฌ [Join Discussions](https://github.com/pauljohn21/dioxus-element-plug/discussions)
## Project Status
**๐ Production Ready** - Fully implemented and tested Element Plus component library for Dioxus!
- โ
**95+ Components**: Complete Element Plus design system
- โ
**Pure Rust Styling**: Zero runtime overhead
- โ
**Type Safety**: Compile-time validation
- โ
**Modern Example**: See [modern-pure-rust-example/](examples/modern-pure-rust-example/)
- โ
**Documentation**: Complete API docs on [docs.rs](https://docs.rs/dioxus-element-plug)
**Ready to build beautiful Dioxus applications with Element Plus components!** ๐