Accordion
Coordinates one or more expandable sections and their keyboard focus.
Loading interactive demo…
let accordion = Accordion::new("faq");
let item = accordion.item("one", 0, true);
item.root().child(item.trigger_with(text("Details")))#Import
Import Accordion from quickgui.
use quickgui::*;#Usage
let accordion = Accordion::new("faq");
let item = accordion.item("one", 0, true);
item.root().child(item.trigger_with(text("Details")))#Anatomy
Accordion::rootAccordion::itemAccordion::headerAccordion::triggerAccordion::panel
#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
Accordion
View sourcepub fn new(root_id: impl Into<ElementId>) -> Selfdisabledpub const fn disabled(mut self, disabled: bool) -> Self—
Configures disabled for this part.
pub const fn disabled(mut self, disabled: bool) -> SelfView sourcekeep_mountedpub const fn keep_mounted(mut self, keep_mounted: bool) -> Self—
Configures keep mounted for this part.
pub const fn keep_mounted(mut self, keep_mounted: bool) -> SelfView sourceheading_levelpub fn heading_level(mut self, level: usize) -> Self—
Configures heading level for this part.
pub fn heading_level(mut self, level: usize) -> SelfView sourceroot_idpub const fn root_id(self) -> ElementId—
itempub fn item(self, value: impl Into<ElementId>, index: usize, open: bool) -> AccordionItem—
Configures item for this part.
pub fn item(self, value: impl Into<ElementId>, index: usize, open: bool) -> AccordionItemView sourceitem_from_statepub fn item_from_state( self, value: impl Into<ElementId>, index: usize, state: &AccordionState, ) -> AccordionItem—
Configures item from state for this part.
pub fn item_from_state( self, value: impl Into<ElementId>, index: usize, state: &AccordionState, ) -> AccordionItemView sourceAccordion::root_with
View sourcepub fn root_with(self, root: Element) -> ElementAccordion::root
View sourcepub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
AccordionItem
View sourcepub fn disabled(mut self, disabled: bool) -> Selfkeep_mountedpub const fn keep_mounted(mut self, keep_mounted: bool) -> Self—
Configures keep mounted for this part.
pub const fn keep_mounted(mut self, keep_mounted: bool) -> SelfView sourceheading_levelpub fn heading_level(mut self, level: usize) -> Self—
Configures heading level for this part.
pub fn heading_level(mut self, level: usize) -> SelfView sourcestatepub const fn state(self) -> AccordionItemState—
valuepub const fn value(self) -> ElementId—
indexpub const fn index(self) -> usize—
This item's declared position in the accordion, Base UI's `data-index`.
pub const fn index(self) -> usizeView sourceroot_idpub fn root_id(self) -> ElementId—
header_idpub fn header_id(self) -> ElementId—
trigger_idpub fn trigger_id(self) -> ElementId—
panel_idpub fn panel_id(self) -> ElementId—
is_openpub const fn is_open(self) -> bool—
is_disabledpub const fn is_disabled(self) -> bool—
panel_is_mountedpub const fn panel_is_mounted(self) -> bool—
AccordionItem::root_with
View sourcepub fn root_with(self, root: Element) -> ElementAccordionItem::root
View sourcepub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
AccordionItem::header_with
View sourcepub fn header_with(self, header: Element) -> ElementDecorate the caller-owned heading that contains only this item's trigger.
AccordionItem::header
View sourcepub fn header(self) -> ElementCreate the unstyled header part. Use [`Self::header_with`] to supply an existing element.
AccordionItem::trigger_with
View sourcepub fn trigger_with(self, trigger: Element) -> ElementAccordionItem::trigger
View sourcepub fn trigger(self) -> ElementCreate the unstyled trigger part. Use [`Self::trigger_with`] to supply an existing element.
AccordionItem::panel_with
View sourcepub fn panel_with(self, panel: Element) -> Option<Element>Decorate the item panel as a named accessibility region when mounted.
AccordionItem::panel
View sourcepub fn panel(self) -> Option<Element>Create the unstyled panel part. Use [`Self::panel_with`] to supply an existing element.
