Function freya_components::Popup

source ·
pub fn Popup(__props: 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 {
             onclick: move |_| show_popup.set(true),
             label {
                 "Open"
             }
         }
    )
}

§Props

For details, see the props struct definition.

  • 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.