pub struct ModalProps {
pub show: Signal<bool>,
pub title: String,
pub body: Option<Element>,
pub footer: Option<Element>,
pub size: ModalSize,
pub backdrop_close: bool,
pub show_close: bool,
pub centered: bool,
pub scrollable: bool,
pub class: String,
pub children: Element,
}Expand description
Bootstrap Modal component — signal-driven, no JavaScript.
let show = use_signal(|| false);
rsx! {
Button { onclick: move |_| show.set(true), "Open Modal" }
Modal {
show: show,
title: "Confirm Action",
body: rsx! { p { "Are you sure you want to proceed?" } },
footer: rsx! {
Button { color: Color::Secondary, onclick: move |_| show.set(false), "Cancel" }
Button { color: Color::Primary, "Confirm" }
},
}
}Fields§
§show: Signal<bool>Signal controlling modal visibility.
title: StringModal title.
body: Option<Element>Modal body content.
Modal footer content.
size: ModalSizeModal size.
backdrop_close: boolClose when clicking the backdrop.
show_close: boolShow the close button in the header.
centered: boolCenter the modal vertically.
scrollable: boolAllow the modal body to scroll.
class: StringAdditional CSS classes for the modal-dialog.
children: ElementChild elements (alternative to body prop for custom layout).
Implementations§
Source§impl ModalProps
impl ModalProps
Sourcepub fn builder() -> ModalPropsBuilder<((), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> ModalPropsBuilder<((), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building ModalProps.
On the builder, call .show(...), .title(...)(optional), .body(...)(optional), .footer(...)(optional), .size(...)(optional), .backdrop_close(...)(optional), .show_close(...)(optional), .centered(...)(optional), .scrollable(...)(optional), .class(...)(optional), .children(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of ModalProps.
Trait Implementations§
Source§impl Clone for ModalProps
impl Clone for ModalProps
Source§fn clone(&self) -> ModalProps
fn clone(&self) -> ModalProps
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more