DioxusLabs/dioxus · error · syn::Error
Props is not supported for unions
Error message
Props is not supported for unions
What it means
The `#[derive(Props)]` macro rejects unions at derive expansion time, emitting this compile error at the struct/union span. Component props must be structs with named fields; unions cannot represent a set of prop fields, so deriving Props on a union is unsupported.
Solutions
- Define props as a struct with named fields instead of a union; the Props derive only supports structs.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/core-macro/src/props/mod.rs:69 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23).
Data as JSON: /api/errors/2836480292c5c3e9.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core-macro/src/props/mod.rs:69
}
syn::Fields::Unnamed(_) => {
return Err(Error::new(
ast.span(),
"Props is not supported for tuple structs",
));
}
syn::Fields::Unit => {
return Err(Error::new(
ast.span(),
"Props is not supported for unit structs",
));
}
},
syn::Data::Enum(_) => {
return Err(Error::new(ast.span(), "Props is not supported for enums"));
}
syn::Data::Union(_) => {
return Err(Error::new(ast.span(), "Props is not supported for unions"));
}
};
Ok(data)
}
mod util {
use quote::ToTokens;
pub fn path_to_single_string(path: &syn::Path) -> Option<String> {
if path.leading_colon.is_some() {
return None;
}
let mut it = path.segments.iter();
let segment = it.next()?;
if it.next().is_some() {
// Multipart path
return None;
}View on GitHub (pinned to 24f6a829df)