Macro freya::prelude::use_applied_theme

macro_rules! use_applied_theme {
    ($theme_prop:expr, $theme_name:ident) => { ... };
}
Expand description

This macro has three arguments separator by commas.

  1. The theme property. This should be &cx.props.theme.
  2. The name of the theme that you want to use.

ยงExamples

use freya::prelude::*;

#[derive(Props, PartialEq, Clone)]
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);
    // ...

}