Macro freya::hooks::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.

  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);
    // ...

}