Bootstrap 5.3 components for Dioxus. The crate uses real Bootstrap CSS and Bootstrap Icons, bundles assets for offline-first apps, and replaces Bootstrap JavaScript behavior with Dioxus signals.
Live showcase: https://mik-tf.github.io/dioxus-bootstrap-css/
API docs: https://docs.rs/dioxus-bootstrap-css
Repository: https://github.com/mik-tf/dioxus-bootstrap-css
Short name: dbcss means dioxus-bootstrap-css. The full crate name is long,
so issues and notes may use the abbreviation.
Design rule: if Bootstrap does it, this crate should expose a typed Dioxus way to express it. If Bootstrap does not do it, this crate should not invent it.
- Pixel fidelity by using Bootstrap 5.3 CSS instead of a reimplementation.
- Zero Bootstrap JavaScript; interactions are driven by Dioxus state.
- Offline-first CSS and icon assets through
BootstrapHead. - Type-safe component props for color, size, state, slots, and variants.
- Migration tools for converting raw Bootstrap RSX into typed components.
cargo add dioxus-bootstrap-cssOr pin it in Cargo.toml:
[dependencies]
dioxus = { version = "0.7", features = ["web"] }
dioxus-bootstrap-css = "0.5"use dioxus::prelude::*;
use dioxus_bootstrap_css::prelude::*;
fn main() {
dioxus::launch(app);
}
fn app() -> Element {
let theme = use_signal(|| Theme::Dark);
rsx! {
ThemeProvider { theme }
BootstrapHead {}
Container { class: "py-4",
Row { class: "g-3",
Col { md: ColumnSize::Span(6),
Card {
header: rsx! { "Getting Started" },
body: rsx! {
p { "Bootstrap in Dioxus - fully offline, fully Rust." }
Button { color: Color::Primary, "Launch" }
},
}
}
Col { md: ColumnSize::Span(6),
Alert { color: Color::Success, "Everything works out of the box." }
}
}
}
}
}Layout and head:
BootstrapHeadThemeProvider,ThemeToggleContainer,Row,Col
Content and data display:
Button,ButtonGroup,ButtonToolbarCard,Alert,Badge,Icon,SpinnerProgress,ProgressBar,Placeholder,Figure,RatioTable,ListGroup,Pagination
Forms:
FormGroup,Input,Select,TextareaCheckbox,Radio,Switch,RangeFloatingLabel,InputGroup,FormFeedback,FormText
Interactive components:
Modal,Dropdown,Collapse,Tabs,TabListAccordion,Offcanvas,Toast,CarouselTooltip,Popover,ScrollspyNavbar,NavbarToggler,NavbarCollapse,NavbarNav,Nav,Breadcrumb
let theme = use_signal(|| Theme::Dark);
rsx! {
ThemeProvider { theme }
BootstrapHead {}
ThemeToggle { theme }
}ThemeProvider sets data-bs-theme on the document and lets Bootstrap handle
the rest.
Convert Bootstrap HTML or raw Bootstrap RSX by replacing component classes with typed components:
Button {
color: Color::Secondary,
outline: true,
size: Size::Sm,
class: "border-0",
"Refresh"
}Key principles:
- Use Bootstrap utility classes (
small,py-2,mb-0) for layout and spacing. - Use component props (
color,outline,size,header_class,responsive) for component intent. - Replace Bootstrap JavaScript with Dioxus signals.
- Treat
tools/check-no-raw-bootstrap.mjsas a completeness gate, not a visual-fidelity proof. - Let the converter map Bootstrap intent to props, flag unsafe cases instead of guessing, then prove fidelity with Playwright screenshots.
See docs/04_migration.md for the complete workflow.
node tools/migrate-bootstrap-rsx.mjs path/to/app/src
node tools/migrate-bootstrap-rsx.mjs --check path/to/app/src
node tools/migrate-bootstrap-rsx.mjs --write path/to/app/src
node tools/check-no-raw-bootstrap.mjs path/to/app/src
npm run lint:bootstraptools/README.md documents the converter and migration gate.
examples/showcasedemonstrates the component set.examples/dashboardis a compact admin dashboard example.
See CHANGELOG.md.
See docs/08_release.md.
Apache-2.0.