Framework guide: Dioxus
Rust components for Dioxus 0.7 that render the same markup and stylesheet as the React adapter on web, desktop, mobile, and Dioxus Native.
- Language
- Rust
- Dioxus
- 0.7
- Components
- 239
Lumen 6 introduces the stable lumen-dioxus 6.0 release line, which shares the Lumen major. The setup below follows the current release contract; check crates.io for publication before installing. Existing experimental consumers should rename ToggleProps to CheckboxProps and replace CardVariant::Glass with the glass prop. See the v6 migration guide.
Installation
Add lumen-dioxus from crates.io. Your app picks its renderer through the features of its own dioxus dependency; the crate itself only uses Dioxus components, signals, and hooks.
Cargo
cargo add lumen-dioxusOr edit Cargo.toml
[dependencies]
dioxus = { version = "0.7", features = ["web"] }
lumen-dioxus = "6.0"Quick start
Import the prelude, render LumenStyles once near the root, and compose components. LumenStyles embeds the complete Lumen stylesheet in a <style> element; if you load styles another way, lumen_dioxus::LUMEN_CSS holds the same CSS as a string.
Collapse example37 lines
use dioxus::prelude::*;
use lumen_dioxus::prelude::*;
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
let mut notifications = use_signal(|| true);
rsx! {
LumenStyles {}
LumenTheme {
Card {
CardHeader {
CardTitle { "Workspace plan" }
CardDescription { "Shared libraries and audit logs." }
}
CardContent {
label {
Switch {
checked: notifications(),
onchange: move |next| notifications.set(next),
aria_label: "Notifications",
}
"Notifications"
}
}
CardFooter {
Button { variant: ButtonVariant::Secondary, "Compare plans" }
Button { onclick: move |_| {}, "Upgrade" }
}
}
}
}
}use dioxus::prelude::*;
use lumen_dioxus::prelude::*;
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
let mut notifications = use_signal(|| true);
rsx! {Components render the same classes and attributes as the React adapter, so Lumen CSS styles them the same way. Every component also accepts class, appended after the Lumen classes, and any attribute its HTML element accepts, such as id, aria_label, or r#for.
Renderers
Choose a renderer with the dioxus features in your app’s Cargo.toml. Web and mobile builds use the Dioxus CLI: install it with cargo install dioxus-cli and keep it on the same 0.7 release line as your dioxus dependency.
| Renderer | dioxus features | Run your app | Crate example |
|---|---|---|---|
| WebBrowsers, compiled to WebAssembly | ["web"] | dx serve --platform web | dx serve --example web --features web-example --platform web |
| DesktopmacOS, Windows, and Linux in the system webview | ["desktop"] | dx serve --platform desktop | cargo run --example desktop --features desktop-example |
| MobileiOS and Android in the system webview | ["mobile"] | dx serve --platform iosdx serve --platform android | No mobile example yet |
| Dioxus NativeNative windows drawn by the Blitz engine, without a webview | ["native"] | cargo run | cargo run --example gallery --features native-example |
| Server renderingHTML strings for servers and static sites | ["ssr"] | cargo run | cargo run --example ssr > lumen.html |
Render on the server
With the ssr feature, dioxus::ssr renders Lumen components to an HTML string for servers and static sites. Include LumenStyles in the rendered tree, or serve LUMEN_CSS as a stylesheet.
use dioxus::prelude::*;
use lumen_dioxus::prelude::*;
fn main() {
let html = dioxus::ssr::render_element(rsx! {
LumenStyles {}
Button { "Upgrade" }
});
println!("{html}");
}Theming
LumenTheme applies a color scheme and an appearance preset to its children and paints the canvas, text color, and font. It sets the same data-theme, data-lumen-scheme, and data-lumen-preset attributes the other adapters set on <html>, so it works on every renderer, including Dioxus Native. Wrap the whole app, or nest it to theme one section.
use dioxus::prelude::*;
use lumen_dioxus::prelude::*;
#[component]
fn App() -> Element {
let mut scheme = use_signal(|| LumenScheme::Light);
rsx! {
LumenStyles {}
LumenTheme { scheme: scheme(), preset: LumenPreset::Paper,
Button { onclick: move |_| scheme.set(scheme().toggled()), "Toggle dark mode" }
// Nest a theme to style one section differently.
LumenTheme { scheme: LumenScheme::Dark, preset: LumenPreset::Voltage,
Card { CardContent { "Always dark" } }
}
}
}
}LumenScheme is Light or Dark, and toggled() flips it. Every LumenPreset has light and dark variants:
LumenPreset::DefaultLumenPreset::ClassicLumenPreset::PaperLumenPreset::LuminousLumenPreset::VoltageLumenPreset::SignalLumenPreset::StudioLumenPreset::Aura
LumenPreset::Default uses the v6 cool neutrals, graphite actions, violet emphasis and Inter. Choose LumenPreset::Classic for the earlier warm palette and Montserrat, or LumenPreset::Studio for dense, quiet surfaces in editors, consoles and admin tools. LumenStyles embeds the default font bytes with its CSS. Compare the presets in the theme playground.
Icons
Icon draws inline SVG that follows the text color. Pass a constant from icons::lucide so only the icons you use reach the binary, or resolve a name from the Lumen icon catalog at runtime. Give meaningful icons a label; unnamed icons are decorative.
rsx! {
// A constant keeps only the icons you use in the binary.
Icon { icon: &icons::lucide::TRASH, label: "Delete" }
// A name resolves at runtime from the full Lucide catalog.
Icon { name: "trash", size: IconSize::Lg }
// Brand icons need the brand-icons feature.
Icon { name: "brand:github", label: "GitHub" }
}Brand icons (Font Awesome Free, CC BY 4.0) are behind the brand-icons feature. Enable it to use icons::brand constants and brand: names:
[dependencies]
lumen-dioxus = { version = "6.0", features = ["brand-icons"] }Component coverage
lumen-dioxus exports a component for each of the Lumen registry’s components, 239 in all, with the same names as the React adapter. Each name links to its component page for behavior, props, and accessibility guidance. Pages marked Rust example (239 so far) include a compiled Dioxus tab in their code example.
Actions 9
- ButtonRust example
- ButtonGroupRust example
- CopyButtonRust example
- LanguageToggleRust example
- SelectionBarRust example
- SwipeCardRust example
- ThemeToggleRust example
- ToggleRust example
- ToggleGroupRust example
AI 8
- ApprovalCardRust example
- MessageActionsRust example
- PromptComposerRust example
- PromptSuggestionsRust example
- ReasoningRust example
- SourceCitationRust example
- StreamMessageRust example
- ToolActivityRust example
Brand 4
- AnimatedLogoRust example
- AnimatedPortraitRust example
- BackdropRust example
- GraphicRust example
Data display 80
- AgendaRust example
- AnimatedNumberRust example
- AttachmentRust example
- AttachmentListRust example
- AttachmentPreviewRust example
- AvatarRust example
- BadgeRust example
- BarChartRust example
- BoxPlotRust example
- BubbleRust example
- BulletChartRust example
- CalendarHeatmapRust example
- ChangeSummaryRust example
- ChartRust example
- ChartMotionRust example
- CodeRust example
- CodeTabsRust example
- ComboChartRust example
- CoverImageRust example
- DataTableRust example
- DescriptionDetailRust example
- DescriptionItemRust example
- DescriptionsRust example
- DescriptionTermRust example
- DeviceFrameRust example
- DumbbellChartRust example
- EyebrowRust example
- FilterBarRust example
- FloatingBadgeRust example
- FormattedDateRust example
- FormattedNumberRust example
- FunnelChartRust example
- HeatmapRust example
- HistogramRust example
- IconRust example
- ImageRust example
- ImageComparisonRust example
- InstallCommandRust example
- ItemRust example
- KbdRust example
- LineChartRust example
- LollipopChartRust example
- MarkerRust example
- MediaFilmstripRust example
- MediaThumbnailRust example
- MediaViewportRust example
- MessageRust example
- MeterRust example
- NoteRust example
- PieChartRust example
- PillRust example
- QRCodeRust example
- RangeChartRust example
- RatingRust example
- ReorderableListRust example
- ScatterChartRust example
- ScheduleRust example
- SecretValueRust example
- SparklineRust example
- SplitTextRust example
- StatRust example
- StatDescriptionRust example
- StatGroupRust example
- StatIconRust example
- StatLabelRust example
- StatTrendRust example
- StatValueRust example
- TableRust example
- TerminalRust example
- TestimonialRust example
- TestimonialGroupRust example
- ThemeBuilderRust example
- TimelineRust example
- TimerRust example
- TreeRust example
- TreeGridRust example
- TypographyRust example
- VirtualListRust example
- WaterfallChartRust example
- WorldMapRust example
Feedback 13
- AlertRust example
- CalloutRust example
- EmptyRust example
- ErrorStateRust example
- IllustrationRust example
- ProgressRust example
- RouteProgressRust example
- ScrollProgressRust example
- SkeletonRust example
- SpinnerRust example
- StatusDotRust example
- ToastRust example
- ToastViewportRust example
Forms 42
- AmountFieldRust example
- AutocompleteRust example
- CalendarRust example
- CascaderRust example
- CharacterCountRust example
- CheckboxRust example
- CheckboxCardRust example
- CheckboxGroupRust example
- ColorPickerRust example
- ComboboxRust example
- DatePickerRust example
- DateRangePickerRust example
- ErrorSummaryRust example
- FieldRust example
- FieldErrorRust example
- FileUploadRust example
- FormRust example
- InlineEditRust example
- InputRust example
- InputGroupRust example
- InputOTPRust example
- LabelRust example
- ListBoxRust example
- MentionsRust example
- NativeSelectRust example
- NumberFieldRust example
- PasswordFieldRust example
- PhoneInputRust example
- RadioCardRust example
- RadioGroupRust example
- RichTextEditorRust example
- SearchFieldRust example
- SegmentedRust example
- SelectRust example
- SettingsRowRust example
- SliderRust example
- SwitchRust example
- TagGroupRust example
- TextareaRust example
- TimeFieldRust example
- TransferRust example
- TreeSelectRust example
Interaction 2
- MotionGroupRust example
- TextRollRust example
Layout 38
- AccordionRust example
- AffixRust example
- AspectRatioRust example
- CardRust example
- CardContentRust example
- CardDescriptionRust example
- CardFooterRust example
- CardHeaderRust example
- CardTitleRust example
- CarouselRust example
- CollapsibleRust example
- ContainerRust example
- DirectionRust example
- FeatureGridRust example
- GradientDividerRust example
- GridRust example
- HeroRust example
- KanbanBoardRust example
- KanbanColumnRust example
- MarqueeRust example
- MessageScrollerRust example
- PageHeaderRust example
- ParallaxRust example
- ParticlesRust example
- ProseRust example
- ResizableRust example
- RevealGroupRust example
- ScrollAreaRust example
- ScrollRevealRust example
- SectionHeaderRust example
- SeparatorRust example
- StackRust example
- StepsRust example
- ToolbarRust example
- ViewProgressRust example
- VisualEffectRust example
- VisuallyHiddenRust example
- WatermarkRust example
Navigation 24
- AnchorRust example
- AppHeaderRust example
- BackToTopRust example
- BreadcrumbRust example
- ButtonLinkRust example
- CommandRust example
- ContextNavigationRust example
- HeadingAnchorRust example
- LinkRust example
- LoadMoreRust example
- MenubarRust example
- NavigationMenuRust example
- PageNavRust example
- PaginationRust example
- ShareLinksRust example
- SidebarRust example
- SidebarItemRust example
- SidebarTriggerRust example
- SiteFooterRust example
- SiteHeaderRust example
- SkipLinkRust example
- SpeedDialRust example
- StepperRust example
- TabsRust example
Overlays 19
- AlertDialogRust example
- ContextMenuRust example
- DialogRust example
- DialogBodyRust example
- DialogCloseRust example
- DialogFooterRust example
- DialogFormRust example
- DialogHeaderRust example
- DialogTitleRust example
- DrawerRust example
- DropdownMenuRust example
- HoverCardRust example
- PopconfirmRust example
- PopoverRust example
- SearchDialogRust example
- SearchDialogTriggerRust example
- SheetRust example
- TooltipRust example
- TourRust example
Dioxus Native support and limits
Dioxus Native draws HTML and CSS with the Blitz engine instead of a webview. The components keep one markup contract across renderers, so a few behaviors follow what Blitz supports today.
- Events and focus
- Dioxus Native reports click, mouse, keyboard, and input events, but no pointer, hover, scroll, wheel, resize, double-click, submit, or mounted events yet. Hover cards and tooltips open on click, focus, or a controlled open prop; drags use mouse events; scroll-linked components take controlled values; and roving focus updates the tab stop without moving DOM focus.
- SVG icons and charts
- Blitz draws inline SVG as an image, so Lumen CSS does not reach it: icons and chart marks keep their default colors and cannot be clicked. Chart legends, data tables, and the HTML-based charts work fully.
- Checkbox and Switch
- Checkbox and Switch render as <button role="checkbox"> and <button role="switch"> with aria-checked on every renderer, because Blitz ignores appearance: none on native inputs. A named, checked control also renders a hidden input, so forms still submit its value.
- Placeholders
- Input and Textarea placeholders do not show on Dioxus Native yet. Keep a visible Label on every field.
- Glass
- Glass surfaces need backdrop-filter, which Dioxus Native draws only with its Skia renderer.
- Brand gradients
- The Aura brand gradient is a plain three-stop linear-gradient layered over the solid brand color, and the glow elevation is made of box shadows. Dioxus Native draws both; a renderer that cannot draw the gradient shows the solid brand color.
- Floating panels
- Dialogs, popovers, menus, and other floating panels stay in the component tree instead of the browser top layer, placed by Lumen CSS. A transparent dismiss layer closes them on an outside click, and Escape closes them from the focused panel.
- Web-only APIs
- Clipboard access, scroll observers, contenteditable editing, and Rive animations run through dioxus::document::eval in browsers and webviews. Dioxus Native has no JavaScript engine, so those enhancements are skipped there.
The crate README tracks the current Blitz gaps as Dioxus Native support grows.
Examples
The crate ships a component gallery for each renderer and a server-rendering example. Run them from packages/dioxus in a clone of the repository. Every Dioxus example on this site compiles as a crate test, so it stays in step with the crate API.
git clone https://github.com/santi020k/lumen.git
cd lumen/packages/dioxus
# Every component on Dioxus Native
cargo run --example gallery --features native-example
# The same gallery in a desktop webview
cargo run --example desktop --features desktop-example
# The same gallery in the browser (needs the Dioxus CLI)
dx serve --example web --features web-example --platform web
# A Lumen page rendered to an HTML file
cargo run --example ssr > lumen.htmlVersioning and MSRV
lumen-dioxusshares the Lumen major with every published package and follows semantic versioning within it.lumen-dioxus = "6.0"accepts every compatible 6.x release.- It requires Dioxus 0.7.10 or a later 0.7 release.
- The minimum supported Rust version is 1.88, and the crate uses the 2024 edition.
- Parity tests render each component with Dioxus SSR and compare it with the React adapter’s markup.
docs.rs
API reference for every component, prop, and option enum.
crates.io
Published versions, features, and download statistics.
Crate README
The crate README, examples, and renderer notes on GitHub.