Skip to content

Radio

One selectable item, normally declared inside a RadioGroup.

Loading interactive demo…

#Import

Import Radio from quickgui.

use quickgui::*;

#Usage

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"))

#Anatomy

  • Radio::root
  • Radio::indicator

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

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
View source
is_selectedpub const fn is_selected(self) -> bool—

Configures is selected for this part.

pub const fn is_selected(self) -> bool
View source
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
View source
accepts_selectionpub const fn accepts_selection(self) -> bool—

Whether activating this radio may select it.

pub const fn accepts_selection(self) -> bool
View source

Radio::root_with

View source
pub fn root_with(self, root: Element) -> Element

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

Radio::root

View source
pub fn root(self) -> Element

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

Radio::indicator_with

View source
pub fn indicator_with(self, indicator: Element) -> Element

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

Radio::indicator

View source
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())`.