pub enum DialogVariant {
Default,
Destructive,
Success,
Warning,
Info,
}Expand description
Dialog component with proper accessibility and styling variants
The Dialog component provides accessible modal dialog functionality with proper ARIA attributes, keyboard navigation, focus management, and flexible styling.
§Features
- Proper modal semantics and accessibility
- Focus management and keyboard navigation
- Escape key handling
- Backdrop click handling
- Multiple variants and sizes
- State management (open/closed)
- Event handling
§Example
use leptos::prelude::*;
use radix_leptos_primitives::*;
#[component]
fn MyComponent() -> impl IntoView {
let (isopen, set_isopen) = create_signal(false);
view! {
<Button on_click=move |_| set_isopen.set(true)>
"Open Dialog"
</Button>
<Dialog
open=isopen
onopen_change=move |open| set_isopen.set(open)
>
<DialogContent>
<DialogHeader>
<DialogTitle>"Dialog Title"</DialogTitle>
<DialogDescription>
"This is a dialog description."
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button on_click=move |_| set_isopen.set(false)>
"Close"
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
}
}Variants§
Implementations§
Trait Implementations§
Source§impl Clone for DialogVariant
impl Clone for DialogVariant
Source§fn clone(&self) -> DialogVariant
fn clone(&self) -> DialogVariant
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 DialogVariant
impl Debug for DialogVariant
Source§impl PartialEq for DialogVariant
impl PartialEq for DialogVariant
impl Copy for DialogVariant
impl StructuralPartialEq for DialogVariant
Auto Trait Implementations§
impl Freeze for DialogVariant
impl RefUnwindSafe for DialogVariant
impl Send for DialogVariant
impl Sync for DialogVariant
impl Unpin for DialogVariant
impl UnwindSafe for DialogVariant
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.