Struct patternfly_yew::components::backdrop::Backdrop
source · pub struct Backdrop {
pub content: Html,
}Expand description
Backdrop overlay the main content and show some new content, until it gets closed.
New content can be sent to the backdrop viewer using the Backdropper::open call. It can be
closed using the Backdropper::close call.
Contexts
The BackdropViewer must be wrapped by all contexts which the backdrop content might use,
as the content is injected as a child into the backdrop element. So if you can to send toasts
from a modal dialog, the ToastViewer must be wrapping the
BackdropViewer.
Example
#[function_component(App)]
fn app() -> Html {
html! {
<>
<BackdropViewer>
<View/>
</BackdropViewer>
</>
}
}
#[function_component(View)]
fn view() -> Html {
let backdropper = use_backdrop().expect("Must be nested under a BackdropViewer component");
html!{
<div>
<button onclick={move |_| backdropper.open(Backdrop::new(
html! {
<Bullseye>
<Modal
title={"Example modal"}
variant={ ModalVariant::Medium }
description={"A description is used when you want to provide more info about the modal than the title is able to describe."}
>
<p>{"The modal body can contain text, a form, any nested html will work."}</p>
</Modal>
</Bullseye>
}))
}>
{ "Click me" }
</button>
</div>
}
}Fields§
§content: HtmlImplementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Backdrop
impl !Send for Backdrop
impl !Sync for Backdrop
impl Unpin for Backdrop
impl !UnwindSafe for Backdrop
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self to a value of a Properties struct.source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self to a value of a Properties struct.