Function freya_components::Popup
source · pub fn Popup(_: PopupProps) -> Element
Expand description
Floating window intended for quick interactions. Also called Dialog
in other frameworks.
§Styling
Inherits the PopupTheme
theme.
fn app() -> Element {
let mut show_popup = use_signal(|| false);
rsx!(
if *show_popup.read() {
Popup {
oncloserequest: move |_| {
show_popup.set(false)
},
PopupTitle {
label {
"Awesome Popup"
}
}
PopupContent {
label {
"Some content"
}
}
}
}
Button {
onpress: move |_| show_popup.set(true),
label {
"Open"
}
}
)
}
§Props
For details, see the props struct definition.
theme
:Option<PopupThemeWith>
Theme override.
children
:Element
Popup inner content.
oncloserequest
:Option<EventHandler>
Optional close request handler.
show_close_button
:bool
Whether to show or no the cross button in the top right corner.
close_on_escape_key
:bool
Whether to trigger close request handler when the Escape key is pressed.