Trait tuirealm::Component [−][src]
pub trait Component { fn render(&self, frame: &mut Canvas<'_>, area: Rect); fn update(&mut self, props: Props) -> Msg; fn get_props(&self) -> Props; fn on(&mut self, ev: Event) -> Msg; fn get_state(&self) -> Payload; fn blur(&mut self); fn active(&mut self); }
Expand description
Component
Component is a trait which defines the behaviours for a View component.
Required methods
render
Based on the current properties and states, renders the component in the provided area frame
update
Update component properties
Properties should first be retrieved through get_props
which returns
the current properties, which can be used to create new properties.
Returns a Msg to the view
get_props
Returns the current component properties. The returned properties can then be used to create a new PropsBuilder, which can lately be used to update the component’s properties.
on
Handle input event and update internal states. Returns a Msg to the view