Dioxus Bulma
A comprehensive Rust component library bringing Bulma CSS components to Dioxus applications.
Build beautiful, responsive web applications with the power of Rust and the elegance of Bulma CSS.
Features
- 🎨 Complete Bulma Integration: All Bulma CSS components implemented as Dioxus components
- ⚡ Type-Safe: Leverages Rust's type system for compile-time guarantees and better developer experience
- 🎯 Dioxus Native: Built specifically for the Dioxus ecosystem with proper event handling
- 📱 Responsive Design: Mobile-first responsive design patterns out of the box
- 🌗 Theme Support: Light/dark/auto theme modes with CSS custom properties
- 🧩 Composable Architecture: Mix and match components with consistent APIs
- 🎛️ Rich Props System: Extensive customization through typed props
- 📦 Zero Runtime Dependencies: Pure Rust implementation
Installation
Add this to your Cargo.toml:
[]
= "0.7"
= "0.7"
For web applications, enable the web feature:
[]
= []
= ["dioxus/web"]
= ["dioxus-bulma/router"] # Optional: Enable router integration
Router Integration
Enable router support for seamless navigation with dioxus-router:
[]
= { = "0.7", = ["router"] }
= "0.7"
Dioxus 0.7 Compatibility
This library is fully compatible with Dioxus 0.7. If you're upgrading from Dioxus 0.6, see the Upgrade Guide section below.
Getting Started
1. Basic Setup
Start by wrapping your app with BulmaProvider to enable theme support and CSS loading:
use *;
use *;
use ;
2. Import Patterns
The library provides two import patterns:
Recommended: Using the prelude
use *;
use *;
use ; // Import Title/Subtitle explicitly
Alternative: Component module
use *;
use *;
use *;
Note:
TitleandSubtitlemust be explicitly imported to avoid conflicts with Dioxus 0.7's built-in document components.
3. Building Forms
Create interactive forms with validation:
3. Layout with Grid System
Use Bulma's flexible grid system:
4. Router Integration
Use components with dioxus-router for client-side navigation:
use *;
use *;
use *;
5. Advanced Components
Leverage advanced components like dropdowns and modals:
Available Components
Layout Components
Container- Responsive container with breakpoint optionsSection- Page sections with size variantsColumns/Column- Flexible grid system with responsive sizing and offsetsHero/HeroBody/HeroHead/HeroFoot- Hero banner components with sizesLevel/LevelLeft/LevelRight/LevelItem- Horizontal level layoutMedia/MediaLeft/MediaContent/MediaRight- Media object layoutTile- Metro-style tile layout system
Elements
Button- Full-featured buttons with colors, sizes, states, and variantsTitle/Subtitle- Typography components with proper heading levelsContent- Rich content container with typography stylesDelete- Delete button with size variantsIcon- Icon wrapper with size and color optionsImage- Image container with responsive sizing optionsNotification- Dismissible alert notifications with colors and light variantsProgress- Progress bars with colors and valuesTable- Data tables with styling options (bordered, striped, hoverable)Tag/Tags- Label and tag components with colors, sizes, and variants
Form Components
Input- Text inputs with validation states, icons, and various typesTextarea- Multi-line text areas with rows and validationSelect- Dropdown select inputs with multiple optionsCheckbox- Checkbox inputs with labelsRadio- Radio button inputs with groupingFile- File input components with custom stylingField- Form field wrapper with grouping and addon optionsControl- Form control wrapper with icon and loading supportLabel- Form labels with proper associationHelp- Form help text with color states
Navigation Components
Breadcrumb/BreadcrumbItem- Breadcrumb navigation with separatorsTabs/Tab- Tab navigation with styles (default, boxed, toggle)Pagination/PaginationPrevious/PaginationNext/PaginationList/PaginationLink/PaginationEllipsis- Pagination controls
Components
Card/CardHeader/CardHeaderTitle/CardContent/CardFooter/CardFooterItem- Card componentsDropdown/DropdownTrigger/DropdownMenu/DropdownItem/DropdownDivider- Dropdown menusMenu/MenuLabel/MenuList/MenuItem- Vertical navigation menusMessage/MessageHeader/MessageBody- Message components with colors and close functionalityModal/ModalCard/ModalCardHead/ModalCardBody/ModalCardFoot- Modal dialogsNavbar/NavbarBrand/NavbarMenu/NavbarItem- Navigation barsPanel/PanelHeading/PanelTabs/PanelBlock/PanelIcon- Panel components
Router-Enabled Components 🚀
When the router feature is enabled, these components support the to prop for client-side navigation:
Button- Navigate on click instead of form submissionBreadcrumbItem- Router-aware breadcrumb navigationDropdownItem- Navigate from dropdown menusMenuItem- Navigate from vertical menusPanelBlock- Navigate from panel itemsPaginationPrevious/PaginationNext/PaginationLink- Navigate between pages
Router Props:
to: Route- Navigate to route (takes priority overhref)href: String- Fallback for regular link behavior- All existing styling and event props work normally
Examples
Run the examples to see all components in action:
# Basic demo with core components
# Interactive showcase with all components
# Comprehensive demo showcasing all features
Each example demonstrates different aspects:
- demo: Basic usage patterns and core components
- showcase: Interactive components with state management
- comprehensive_demo: Complete feature set including forms, navigation, and advanced components
Component Props Reference
Core Colors and Sizes
All components support Bulma's color system:
Primary | Link | Info | Success | Warning | Danger |
White | Light | Dark | Black | Text | Ghost
Size variants available:
Small | Normal | Medium | Large
Button
Button
Input
Input
Card Structure
Card
Layout Grid
Columns
Theme System
Wrap your app with BulmaProvider to enable theming:
BulmaProvider
Development Status
This library provides a complete implementation of Bulma CSS components for Dioxus applications.
✅ Fully Implemented
- Layout Components: Container, Columns/Column, Section, Hero, Level, Media, Tile
- Elements: Button, Title/Subtitle, Content, Delete, Icon, Image, Notification, Progress, Table, Tag/Tags
- Form Components: Input, Textarea, Select, Checkbox, Radio, File, Field, Control, Label, Help
- Navigation: Breadcrumb, Tabs, Pagination with all sub-components
- Advanced Components: Card, Dropdown, Menu, Message, Modal, Navbar, Panel
- Theme System: Complete BulmaProvider with light/dark/auto themes
🎯 Features
- Type-safe props with comprehensive validation
- Consistent event handling across all components
- Responsive design patterns built-in
- Full Bulma CSS class coverage
- Zero runtime dependencies
- Comprehensive examples and documentation
🚀 Production Ready
All core Bulma components are implemented and thoroughly tested. The library is suitable for production use in Dioxus web applications.
Best Practices
Component Composition
// Prefer semantic composition
Card
// Over flat structures
div
Form Validation
// Use color props for visual validation feedback
Input
Help
Responsive Design
// Leverage Bulma's responsive system
Columns
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Development Setup
Upgrade Guide: Dioxus 0.6 to 0.7
If you're upgrading from Dioxus 0.6, follow these steps to update your dioxus-bulma integration:
1. Update Dependencies
[]
= "0.7"
= "0.7"
= "0.7" # if using router
2. Update Imports
Before (Dioxus 0.6):
use *;
use *;
After (Dioxus 0.7):
use *;
use *;
use ; // Explicit imports to avoid conflicts
3. Hooks API Changes
Dioxus 0.7 renamed use_state to use_signal:
Before:
let mut count = use_state;
After:
let mut count = use_signal;
4. Children Prop Changes
In Dioxus 0.7, the children prop in component props is required (no longer optional):
Before:
After:
Component Naming Conflicts
Dioxus 0.7 introduces built-in document components (Title, Subtitle) that may conflict with dioxus-bulma components. Always import them explicitly from the components module to ensure you're using the Bulma versions.
For more detailed information, refer to the Dioxus 0.7 Release Notes.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.