pub struct Listbox<S, T> { /* private fields */ }Expand description
A list named label whose selected option is the signal selected.
It follows the WAI-ARIA listbox pattern for a single selection. The list
has role="listbox" and each option role="option" with
aria-selected. Tab enters the list at the selected option, or at the
first where none is selected, and the arrow keys, Home, and End move
between options through El::roving_focus,
selecting each as it gains focus. The ids are derived from the signal’s
path and the option’s position.
use hypersig::Signals;
use hypersig_ui::Listbox;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq)]
enum Plan {
Hobby,
Pro,
}
#[derive(Signals, Serialize, Deserialize)]
struct Billing {
plan: Plan,
}
let plans = Listbox::new("Plan", Billing::plan())
.option(Plan::Hobby, "Hobby")
.option(Plan::Pro, "Pro");
let html = plans.render().render();
assert!(html.contains(r#"role="listbox""#));
assert!(html.contains(r#"id="ui-plan-option-1""#));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<S, T> Freeze for Listbox<S, T>
impl<S, T> RefUnwindSafe for Listbox<S, T>where
T: RefUnwindSafe,
impl<S, T> Send for Listbox<S, T>where
T: Send,
impl<S, T> Sync for Listbox<S, T>where
T: Sync,
impl<S, T> Unpin for Listbox<S, T>where
T: Unpin,
impl<S, T> UnsafeUnpin for Listbox<S, T>
impl<S, T> UnwindSafe for Listbox<S, T>where
T: UnwindSafe,
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