本文へスキップ

Collapsible

アクセシブルな状態を保ちながら、トリガーで 1 つのパネルを表示/非表示にします。

デモを読み込み中…

#インポート

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

use quickgui::*;

#使い方

let disclosure = Collapsible::new("notes", open);
disclosure.root().child(disclosure.trigger_with(text("Notes")))

#構成

  • Collapsible::root
  • Collapsible::trigger
  • Collapsible::panel

#API リファレンス

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

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

Configures disabled for this part.

pub fn disabled(mut self, disabled: bool) -> Self
ソースを見る
keep_mountedpub const fn keep_mounted(mut self, keep_mounted: bool) -> Self—

Retain the closed panel as `display: none` instead of omitting it from the mounted tree.

pub const fn keep_mounted(mut self, keep_mounted: bool) -> Self
ソースを見る
statepub const fn state(self) -> CollapsibleState—

Configures state for this part.

pub const fn state(self) -> CollapsibleState
ソースを見る
root_idpub const fn root_id(self) -> ElementId—

Configures root id for this part.

pub const fn root_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
ソースを見る
keeps_panel_mountedpub const fn keeps_panel_mounted(self) -> bool—

Configures keeps panel mounted for this part.

pub const fn keeps_panel_mounted(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
ソースを見る

Collapsible::root_with

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

Decorate an application-owned structural root without adding role or appearance.

Collapsible::root

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

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

Collapsible::trigger_with

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

Decorate an application-owned trigger with disclosure-button behavior.

Collapsible::trigger

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

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

Collapsible::panel_with

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

Decorate the panel when it should be mounted. The default closed state returns `None`. Pass the result to [`Element::children`] so the `Option<Element>` composes directly. With [`Self::keep_mounted`], a closed panel remains in the retained tree as `display: none` and therefore contributes no layout, paint, input, or accessibility node.

Collapsible::panel

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

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