本文へスキップ

Accordion

1 つ以上の展開セクションと、そのキーボードフォーカスを管理します。

デモを読み込み中…

#インポート

quickgui から Accordion をインポートします。

use quickgui::*;

#使い方

let accordion = Accordion::new("faq");
let item = accordion.item("one", 0, true);
item.root().child(item.trigger_with(text("Details")))

#構成

  • Accordion::root
  • Accordion::item
  • Accordion::header
  • Accordion::trigger
  • Accordion::panel

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

pub fn new(root_id: impl Into<ElementId>) -> Self
disabledpub const fn disabled(mut self, disabled: bool) -> Self—

Configures disabled for this part.

pub const fn disabled(mut self, disabled: bool) -> Self
ソースを見る
keep_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) -> Self
ソースを見る
heading_levelpub fn heading_level(mut self, level: usize) -> Self—

Configures heading level for this part.

pub fn heading_level(mut self, level: usize) -> Self
ソースを見る
root_idpub const fn root_id(self) -> ElementId—

Configures root id for this part.

pub 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) -> AccordionItem
ソースを見る
item_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, ) -> AccordionItem
ソースを見る

Accordion::root_with

ソースを見る
pub fn root_with(self, root: Element) -> Element

Accordion::root

ソースを見る
pub fn root(self) -> Element

Create the unstyled root part. Use [`Self::root_with`] to supply an existing element.

AccordionItem

ソースを見る
pub fn disabled(mut self, disabled: bool) -> Self
keep_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) -> Self
ソースを見る
heading_levelpub fn heading_level(mut self, level: usize) -> Self—

Configures heading level for this part.

pub fn heading_level(mut self, level: usize) -> Self
ソースを見る
statepub const fn state(self) -> AccordionItemState—

Configures state for this part.

pub const fn state(self) -> AccordionItemState
ソースを見る
valuepub const fn value(self) -> ElementId—

Configures value for this part.

pub 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) -> usize
ソースを見る
root_idpub fn root_id(self) -> ElementId—

Configures root id for this part.

pub fn root_id(self) -> ElementId
ソースを見る
header_idpub fn header_id(self) -> ElementId—

Configures header id for this part.

pub fn header_id(self) -> ElementId
ソースを見る
trigger_idpub fn trigger_id(self) -> ElementId—

Configures trigger id for this part.

pub fn trigger_id(self) -> ElementId
ソースを見る
panel_idpub fn panel_id(self) -> ElementId—

Configures panel id for this part.

pub fn panel_id(self) -> ElementId
ソースを見る
is_openpub const fn is_open(self) -> bool—

Configures is open for this part.

pub const fn is_open(self) -> bool
ソースを見る
is_disabledpub const fn is_disabled(self) -> bool—

Configures is disabled for this part.

pub const fn is_disabled(self) -> bool
ソースを見る
panel_is_mountedpub const fn panel_is_mounted(self) -> bool—

Configures panel is mounted for this part.

pub const fn panel_is_mounted(self) -> bool
ソースを見る

AccordionItem::root_with

ソースを見る
pub fn root_with(self, root: Element) -> Element

AccordionItem::root

ソースを見る
pub fn root(self) -> Element

Create the unstyled root part. Use [`Self::root_with`] to supply an existing element.

AccordionItem::header_with

ソースを見る
pub fn header_with(self, header: Element) -> Element

Decorate the caller-owned heading that contains only this item's trigger.

AccordionItem::header

ソースを見る
pub fn header(self) -> Element

Create the unstyled header part. Use [`Self::header_with`] to supply an existing element.

AccordionItem::trigger_with

ソースを見る
pub fn trigger_with(self, trigger: Element) -> Element

AccordionItem::trigger

ソースを見る
pub fn trigger(self) -> Element

Create the unstyled trigger part. Use [`Self::trigger_with`] to supply an existing element.

AccordionItem::panel_with

ソースを見る
pub fn panel_with(self, panel: Element) -> Option<Element>

Decorate the item panel as a named accessibility region when mounted.

AccordionItem::panel

ソースを見る
pub fn panel(self) -> Option<Element>

Create the unstyled panel part. Use [`Self::panel_with`] to supply an existing element.