Attribute Macro appy_macros::derive_component

source ·
#[derive_component]
Expand description

Create a component.

A component takes input in the form of props and children, and return elements describing what should appear on the screen.

Example

#[derive_component(Default,ComponentBuilder)]
pub struct MyComp {
  param1: i32,
  param2: i32
}

impl Element for MyComp {
  pub fn render(self: ElementWrap<Self>)->Elements {
    apx! {
      <bg col=0x000000/>
    }
  }
}

The component declared above can be used together with the apx macro:

apx!{
  <MyComp param1=123 param2=456/>
}