Macro freya::prelude::use_applied_theme
source · macro_rules! use_applied_theme { ($theme_prop:expr, $theme_name:ident) => { ... }; }
Expand description
This macro has three arguments separator by commas.
- The theme property. This should be
&cx.props.theme
. - The name of the theme that you want to use.
Examples
ⓘ
use freya_hooks::{ButtonTheme, ButtonThemeWith};
#[derive(Props)]
pub struct ButtonProps {
/// Theme override.
pub theme: Option<ButtonThemeWith>,
// ...
}
pub fn Button(props: ButtonProps) -> Element {
let ButtonTheme {
padding,
width,
background,
..
} = use_applied_theme!(&props.theme, button);
// ...
}