本文へスキップ

Radio

選択可能な 1 項目です。通常は RadioGroup 内で宣言します。

デモを読み込み中…

#インポート

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

use quickgui::*;

#使い方

let radio = Radio::new(selected);
radio
    .root().flex_row().gap(8.0).on_click(select)
    .child(radio.indicator_with(div().size(16.0, 16.0).rounded(8.0)))
    .child(text("Option A"))

#構成

  • Radio::root
  • Radio::indicator

#API リファレンス

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

pub const fn new(selected: bool) -> Self
read_onlypub const fn read_only(mut self, read_only: bool) -> Self—

Show a value the user may read but not change, Base UI's `readOnly`. A read-only radio stays focusable and keeps taking part in arrow navigation; only the selection it would make is refused.

pub const fn read_only(mut self, read_only: bool) -> Self
ソースを見る
is_selectedpub const fn is_selected(self) -> bool—

Configures is selected for this part.

pub const fn is_selected(self) -> bool
ソースを見る
is_read_onlypub const fn is_read_only(self) -> bool—

Configures is read only for this part.

pub const fn is_read_only(self) -> bool
ソースを見る
accepts_selectionpub const fn accepts_selection(self) -> bool—

Whether activating this radio may select it.

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

Radio::root_with

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

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

pub fn root(self) -> Element

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

Radio::indicator_with

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

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

Radio::indicator

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

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

pub fn radio(selected: bool) -> Element

Create an unstyled controlled radio root. This shorthand is equivalent to `Radio::new(selected).root_with(div())`.