From f0e073305b90da685cb8cd0c3b381d29592fe1ac Mon Sep 17 00:00:00 2001 From: marc2332 Date: Sun, 3 Mar 2024 11:08:59 +0100 Subject: [PATCH] docs --- crates/components/src/popup.rs | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/crates/components/src/popup.rs b/crates/components/src/popup.rs index 819681159..8461f0e7d 100644 --- a/crates/components/src/popup.rs +++ b/crates/components/src/popup.rs @@ -20,6 +20,41 @@ pub fn PopupBackground(children: Element) -> Element { }) } +/// `Popup` component. +/// +/// # Styling +/// Inherits the [`PopupTheme`](freya_hooks::PopupTheme) theme. +/// ```rust, no_run +/// # use freya::prelude::*; +/// 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" +/// } +/// } +/// ) +/// } #[allow(non_snake_case)] #[component] pub fn Popup(