| Crates.io | dioxus-bulma |
| lib.rs | dioxus-bulma |
| version | 0.1.3 |
| created_at | 2025-09-16 03:26:33.606853+00 |
| updated_at | 2025-09-16 05:00:12.723873+00 |
| description | Bulma CSS components for Dioxus |
| homepage | |
| repository | https://github.com/rexlunae/dioxus-bulma |
| max_upload_size | |
| id | 1840906 |
| size | 240,295 |
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.
Add this to your Cargo.toml:
[dependencies]
dioxus-bulma = "0.1.0"
dioxus = "0.6"
For web applications, enable the web feature:
[features]
default = []
web = ["dioxus/web"]
router = ["dioxus-bulma/router"] # Optional: Enable router integration
Enable router support for seamless navigation with dioxus-router:
[dependencies]
dioxus-bulma = { version = "0.1.0", features = ["router"] }
dioxus-router = "0.6"
Start by wrapping your app with BulmaProvider to enable theme support and CSS loading:
use dioxus::prelude::*;
use dioxus_bulma::*;
fn main() {
launch(App);
}
#[component]
fn App() -> Element {
rsx! {
BulmaProvider {
theme: BulmaTheme::Auto, // Auto-detect system theme
load_bulma_css: true, // Auto-load Bulma CSS from CDN
Section {
Container {
Title { size: TitleSize::Is1, "Hello, Dioxus Bulma!" }
Subtitle { size: TitleSize::Is4, "Build beautiful web apps with Rust" }
Button {
color: BulmaColor::Primary,
size: BulmaSize::Large,
onclick: |_| println!("Button clicked!"),
"Get Started"
}
}
}
}
}
}
Create interactive forms with validation:
#[component]
fn ContactForm() -> Element {
let mut name = use_signal(String::new);
let mut email = use_signal(String::new);
rsx! {
Card {
CardHeader { CardHeaderTitle { "Contact Us" } }
CardContent {
Field {
Label { "Name" }
Control {
Input {
input_type: InputType::Text,
placeholder: "Enter your name",
value: name(),
oninput: move |evt: FormEvent| name.set(evt.value())
}
}
}
Field {
Label { "Email" }
Control {
Input {
input_type: InputType::Email,
placeholder: "Enter your email",
color: if email().contains('@') {
Some(BulmaColor::Success)
} else {
None
},
value: email(),
oninput: move |evt: FormEvent| email.set(evt.value())
}
}
Help { color: BulmaColor::Info, "We'll never share your email" }
}
Field { grouped: true,
Control {
Button {
color: BulmaColor::Primary,
onclick: move |_| {
println!("Submitted: {} - {}", name(), email());
},
"Submit"
}
}
Control {
Button {
onclick: move |_| {
name.set(String::new());
email.set(String::new());
},
"Clear"
}
}
}
}
}
}
}
Use Bulma's flexible grid system:
#[component]
fn GridLayout() -> Element {
rsx! {
Container {
Columns {
multiline: true,
Column { size: ColumnSize::Half,
Card {
CardContent {
Title { size: TitleSize::Is4, "Half Width" }
Content { "This column takes half the available width." }
}
}
}
Column { size: ColumnSize::OneQuarter,
Card {
CardContent {
Title { size: TitleSize::Is4, "Quarter Width" }
Content { "This column takes one quarter of the width." }
}
}
}
Column { size: ColumnSize::OneQuarter,
Card {
CardContent {
Title { size: TitleSize::Is4, "Quarter Width" }
Content { "Another quarter width column." }
}
}
}
}
}
}
}
Use components with dioxus-router for client-side navigation:
use dioxus::prelude::*;
use dioxus_router::prelude::*;
use dioxus_bulma::*;
#[derive(Clone, Routable, Debug, PartialEq)]
enum Route {
#[route("/")]
Home {},
#[route("/about")]
About {},
#[route("/contact")]
Contact {},
}
#[component]
fn App() -> Element {
rsx! {
BulmaProvider {
theme: BulmaTheme::Auto,
load_bulma_css: true,
Router::<Route> {}
// Navigation with router-enabled components
Section {
Container {
// Button navigation
Field { grouped: true,
Control {
Button {
color: BulmaColor::Primary,
to: Route::Home {},
"Home"
}
}
Control {
Button {
color: BulmaColor::Link,
to: Route::About {},
"About"
}
}
Control {
Button {
color: BulmaColor::Info,
to: Route::Contact {},
"Contact"
}
}
}
// Breadcrumb navigation
Breadcrumb {
BreadcrumbItem { to: Route::Home {}, "Home" }
BreadcrumbItem { to: Route::About {}, "About" }
BreadcrumbItem { active: true, "Current Page" }
}
// Content
Outlet::<Route> {}
}
}
}
}
}
#[component]
fn Home() -> Element {
rsx! {
Title { size: TitleSize::Is2, "Welcome Home" }
Content { "This is the home page." }
}
}
#[component]
fn About() -> Element {
rsx! {
Title { size: TitleSize::Is2, "About Us" }
Content { "Learn more about our company." }
}
}
#[component]
fn Contact() -> Element {
rsx! {
Title { size: TitleSize::Is2, "Contact" }
Content { "Get in touch with us." }
}
}
Leverage advanced components like dropdowns and modals:
#[component]
fn AdvancedDemo() -> Element {
let mut show_modal = use_signal(|| false);
let mut dropdown_active = use_signal(|| false);
rsx! {
// Dropdown
Dropdown {
active: dropdown_active(),
DropdownTrigger {
onclick: move |_| dropdown_active.set(!dropdown_active()),
Button { color: BulmaColor::Primary, "Options ▼" }
}
DropdownMenu {
DropdownItem { "Action" }
DropdownItem { "Another action" }
DropdownDivider {}
DropdownItem { active: true, "Active item" }
}
}
// Modal trigger
Button {
color: BulmaColor::Info,
onclick: move |_| show_modal.set(true),
"Open Modal"
}
// Modal
Modal {
active: show_modal(),
onclose: move |_| show_modal.set(false),
ModalCard {
ModalCardHead {
onclose: move |_| show_modal.set(false),
Title { size: TitleSize::Is4, "Modal Title" }
}
ModalCardBody {
Content { "This is the modal content!" }
}
ModalCardFoot {
Button {
color: BulmaColor::Success,
onclick: move |_| show_modal.set(false),
"Save"
}
Button {
onclick: move |_| show_modal.set(false),
"Cancel"
}
}
}
}
}
}
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 systemButton - 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 variantsInput - 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 statesBreadcrumb / BreadcrumbItem - Breadcrumb navigation with separatorsTabs / Tab - Tab navigation with styles (default, boxed, toggle)Pagination / PaginationPrevious / PaginationNext / PaginationList / PaginationLink / PaginationEllipsis - Pagination controlsCard / 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 componentsWhen 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 pagesRouter Props:
to: Route - Navigate to route (takes priority over href)href: String - Fallback for regular link behaviorRun the examples to see all components in action:
# Basic demo with core components
cargo run --example demo --features web
# Interactive showcase with all components
cargo run --example showcase --features web
# Comprehensive demo showcasing all features
cargo run --example comprehensive_demo --features web
Each example demonstrates different aspects:
All components support Bulma's color system:
BulmaColor::Primary | Link | Info | Success | Warning | Danger |
White | Light | Dark | Black | Text | Ghost
Size variants available:
BulmaSize::Small | Normal | Medium | Large
Button {
color: BulmaColor::Primary, // Color scheme
size: BulmaSize::Medium, // Button size
outlined: true, // Outlined style
rounded: true, // Rounded corners
loading: false, // Loading state
disabled: false, // Disabled state
fullwidth: false, // Full width
onclick: |_| { /* handler */ }, // Click handler
"Button Text"
}
Input {
input_type: InputType::Email, // Text, Email, Password, etc.
placeholder: "Enter email...", // Placeholder text
value: email_value, // Controlled value
color: BulmaColor::Success, // Validation color
size: BulmaSize::Large, // Input size
readonly: false, // Read-only state
disabled: false, // Disabled state
oninput: |evt| { /* handler */ } // Input handler
}
Card {
CardHeader {
CardHeaderTitle { "Card Title" }
}
CardContent {
// Main content
}
CardFooter {
CardFooterItem { href: "#", "Action" }
CardFooterItem { "Another Action" }
}
}
Columns {
multiline: true, // Allow wrapping
centered: false, // Center columns
vcentered: false, // Vertical centering
mobile: false, // Force on mobile
Column {
size: ColumnSize::Half, // Fractional sizing
offset: ColumnSize::OneQuarter, // Column offset
// Content
}
}
Wrap your app with BulmaProvider to enable theming:
BulmaProvider {
theme: BulmaTheme::Auto, // Auto, Light, or Dark
load_bulma_css: true, // Auto-load Bulma CSS from CDN
// Your app components...
}
This library provides a complete implementation of Bulma CSS components for Dioxus applications.
All core Bulma components are implemented and thoroughly tested. The library is suitable for production use in Dioxus web applications.
// Prefer semantic composition
Card {
CardHeader { CardHeaderTitle { "User Profile" } }
CardContent {
Media {
MediaLeft { Image { /* avatar */ } }
MediaContent { /* user info */ }
}
}
CardFooter {
CardFooterItem { "Edit" }
CardFooterItem { "Delete" }
}
}
// Over flat structures
div { class: "card",
div { class: "card-header", /* ... */ }
div { class: "card-content", /* ... */ }
}
// Use color props for visual validation feedback
Input {
color: if is_valid { BulmaColor::Success } else { BulmaColor::Danger },
// ...
}
Help {
color: BulmaColor::Danger,
"Please enter a valid email address"
}
// Leverage Bulma's responsive system
Columns {
Column { size: ColumnSize::IsFullMobile, /* mobile: full width */ }
Column { size: ColumnSize::IsHalfTablet, /* tablet: half width */ }
}
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.
git clone https://github.com/your-username/dioxus-bulma
cd dioxus-bulma
cargo check
cargo run --example comprehensive_demo --features web
Licensed under either of
at your option.