pub struct Modal { /* private fields */ }Expand description
A modal dialog widget
Implementations§
Source§impl Modal
impl Modal
Set buttons
Sourcepub fn yes_no_cancel(self) -> Self
pub fn yes_no_cancel(self) -> Self
Add Yes, No, and Cancel buttons
Sourcepub fn body(self, widget: impl View + 'static) -> Self
pub fn body(self, widget: impl View + 'static) -> Self
Set a child widget as body content
When a body widget is set, it takes precedence over text content. The widget will be rendered inside the modal’s content area.
§Example
ⓘ
use revue::prelude::*;
let modal = Modal::new()
.title("User Form")
.body(
vstack()
.gap(1)
.child(Input::new().placeholder("Name"))
.child(Input::new().placeholder("Email"))
)
.ok_cancel();Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Check if modal is visible
Get selected button index
Select next button
Select previous button
Sourcepub fn handle_key(&mut self, key: &Key) -> Option<usize>
pub fn handle_key(&mut self, key: &Key) -> Option<usize>
Handle key input, returns Some(button_index) if button confirmed
Trait Implementations§
Source§impl StyledView for Modal
impl StyledView for Modal
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Remove a CSS class
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Toggle a CSS class
Auto Trait Implementations§
impl Freeze for Modal
impl !RefUnwindSafe for Modal
impl !Send for Modal
impl !Sync for Modal
impl Unpin for Modal
impl !UnwindSafe for Modal
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