pub struct Tabs<S, T> { /* private fields */ }Expand description
A tab list named label whose selection is the signal selected, with
one panel per tab.
It follows the WAI-ARIA tabs pattern. The list has role="tablist", each
tab role="tab" with aria-selected and aria-controls, and each panel
role="tabpanel" labeled by its tab. Tab enters the list at the selected
tab, the arrow keys, Home, and End move between tabs, and a tab is
selected as it gains focus, through El::roving_focus. The ids are
derived from the signal’s path and the tab’s position.
use hypersig::Signals;
use hypersig::html::p;
use hypersig_ui::Tabs;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq)]
enum Section {
Account,
Password,
}
#[derive(Signals, Serialize, Deserialize)]
struct Settings {
section: Section,
}
let tabs = Tabs::new("Settings", Settings::section())
.tab(Section::Account, "Account", p().text("Your name and email."))
.tab(Section::Password, "Password", p().text("Change your password."));
let html = tabs.render().render();
assert!(html.contains(r#"role="tablist""#));
assert!(html.contains(r#"aria-controls="ui-section-panel-1""#));Implementations§
Source§impl<S, T: Serialize + PartialEq> Tabs<S, T>
impl<S, T: Serialize + PartialEq> Tabs<S, T>
Trait Implementations§
Auto Trait Implementations§
impl<S, T> Freeze for Tabs<S, T>
impl<S, T> RefUnwindSafe for Tabs<S, T>where
T: RefUnwindSafe,
impl<S, T> Send for Tabs<S, T>where
T: Send,
impl<S, T> Sync for Tabs<S, T>where
T: Sync,
impl<S, T> Unpin for Tabs<S, T>where
T: Unpin,
impl<S, T> UnsafeUnpin for Tabs<S, T>
impl<S, T> UnwindSafe for Tabs<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