Radio
单个可选项,通常在 RadioGroup 中声明。
正在加载交互演示…
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"))#导入
从 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::rootRadio::indicator
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Radio
查看源码pub const fn new(selected: bool) -> Selfread_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—
is_read_onlypub const fn is_read_only(self) -> bool—
accepts_selectionpub const fn accepts_selection(self) -> bool—
Radio::root_with
查看源码pub fn root_with(self, root: Element) -> ElementDecorate an application-owned root without adding layout or appearance.
Radio::root
查看源码pub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Radio::indicator_with
查看源码pub fn indicator_with(self, indicator: Element) -> ElementHide an application-owned visual indicator from the accessible name.
Radio::indicator
查看源码pub fn indicator(self) -> ElementCreate the unstyled indicator part. Use [`Self::indicator_with`] to supply an existing element.
radio
查看源码pub fn radio(selected: bool) -> ElementCreate an unstyled controlled radio root. This shorthand is equivalent to `Radio::new(selected).root_with(div())`.
