本文へスキップ

Toggle

オン/オフの押下状態を保持する、押下可能なコントロールです。

デモを読み込み中…

#インポート

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

use quickgui::*;

#使い方

Toggle::new(pressed)
    .root().on_click(toggle).child("Pin this item")

#構成

  • Toggle::root
  • Toggle::indicator

#API リファレンス

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

pub const fn new(pressed: bool) -> Self
is_pressedpub const fn is_pressed(self) -> bool—

Configures is pressed for this part.

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

Toggle::root_with

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

Decorate an application-owned root without adding layout or appearance.

Toggle::root

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

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

Toggle::indicator_with

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

Hide an application-owned decorative indicator from the accessible name.

Toggle::indicator

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

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

pub fn toggle(pressed: bool) -> Element

Create an unstyled controlled toggle-button root. This shorthand is equivalent to `Toggle::new(pressed).root_with(div())`.