pub enum AlertDialogVariant {
Default,
Destructive,
Warning,
}Expand description
AlertDialog component - Modal alert dialogs for user confirmations
The AlertDialog component provides accessible modal dialogs for critical user actions like confirmations, warnings, and important information display.
§Features
- Accessible modal dialog with proper ARIA attributes
- Focus management and keyboard navigation
- Multiple variants (default, destructive, warning)
- Customizable actions and content
- Backdrop click handling
- Escape key handling
§Example
use leptos::prelude::*;
use radix_leptos_primitives::*;
#[component]
fn MyComponent() -> impl IntoView {
let (show_dialog, set_show_dialog) = create_signal(false);
view! {
<Button on_click=move |_| set_show_dialog.set(true)>
"Delete Item"
</Button>
<AlertDialog
open=show_dialog
onopen_change=move |open| set_show_dialog.set(open)
variant=AlertDialogVariant::Destructive
>
<AlertDialogTitle>"Delete Item"</AlertDialogTitle>
<AlertDialogDescription>
"Are you sure you want to delete this item? This action cannot be undone."
</AlertDialogDescription>
<AlertDialogFooter>
<Button variant=ButtonVariant::Outline on_click=move |_| set_show_dialog.set(false)>
"Cancel"
</Button>
<Button variant=ButtonVariant::Destructive on_click=move |_| {
// Delete logic here
set_show_dialog.set(false);
}>
"Delete"
</Button>
</AlertDialogFooter>
</AlertDialog>
}
}Variants§
Implementations§
Trait Implementations§
Source§impl Clone for AlertDialogVariant
impl Clone for AlertDialogVariant
Source§fn clone(&self) -> AlertDialogVariant
fn clone(&self) -> AlertDialogVariant
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AlertDialogVariant
impl Debug for AlertDialogVariant
Source§impl PartialEq for AlertDialogVariant
impl PartialEq for AlertDialogVariant
impl Copy for AlertDialogVariant
impl StructuralPartialEq for AlertDialogVariant
Auto Trait Implementations§
impl Freeze for AlertDialogVariant
impl RefUnwindSafe for AlertDialogVariant
impl Send for AlertDialogVariant
impl Sync for AlertDialogVariant
impl Unpin for AlertDialogVariant
impl UnwindSafe for AlertDialogVariant
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.