Toolbar
在一套移动焦点的键盘模型下组织操作和输入。
正在加载交互演示…
let bar = Toolbar::new("main", &state, &items);
bar.root().flex_row().gap(8.0)#导入
从 quickgui 导入 Toolbar。
use quickgui::*;#用法
let bar = Toolbar::new("main", &state, &items);
bar.root().flex_row().gap(8.0)#结构
Toolbar::rootToolbar::itemToolbar::buttonToolbar::linkToolbar::inputToolbar::groupToolbar::separator
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Toolbar
查看源码pub fn new( root_id: impl Into<ElementId>, state: &ToolbarState, items: &'a [ToolbarItem], ) -> SelfCreate a toolbar over the caller's ordered items. # Panics Panics with more than [`MAX_TOOLBAR_ITEMS`] items or duplicate item values.
orientationpub const fn orientation(mut self, orientation: ToolbarOrientation) -> Self—
Configures orientation for this part.
pub const fn orientation(mut self, orientation: ToolbarOrientation) -> Self查看源码verticalpub const fn vertical(self) -> Self—
loop_focuspub const fn loop_focus(mut self, loop_focus: bool) -> Self—
Wrap from the last item to the first. The default is `true`.
pub const fn loop_focus(mut self, loop_focus: bool) -> Self查看源码root_idpub const fn root_id(self) -> ElementId—
itemspub const fn items(self) -> &'a [ToolbarItem]—
axispub const fn axis(self) -> ToolbarOrientation—
item_idpub fn item_id(self, value: impl Into<ElementId>) -> ElementId—
roving_valuepub fn roving_value(self) -> Option<ElementId>—
The item that currently owns the toolbar's single Tab stop. This is the controlled active value while it names an enabled mounted item, and otherwise the first enabled item, matching the composite-widget convention.
pub fn roving_value(self) -> Option<ElementId>查看源码itempub fn item(self, value: impl Into<ElementId>) -> Option<ToolbarEntry<'a>>—
Describe one declared item.
pub fn item(self, value: impl Into<ElementId>) -> Option<ToolbarEntry<'a>>查看源码Toolbar::root_with
查看源码pub fn root_with(self, root: Element) -> ElementDecorate an application-owned toolbar root without adding layout or appearance.
Toolbar::root
查看源码pub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Toolbar::group_with
查看源码pub fn group_with(self, group: Element) -> ElementDecorate a caller-owned group of related toolbar items, Base UI's Toolbar.Group. The group is a labelling and structural unit only: every item inside it keeps taking part in the toolbar's single roving Tab stop, so grouping never creates a second focus scope.
Toolbar::group
查看源码pub fn group(self) -> ElementCreate the unstyled group part. Use [`Self::group_with`] to supply an existing element.
Toolbar::separator_with
查看源码pub fn separator_with(self, separator: Element) -> ElementDecorate a caller-owned divider between toolbar groups, Base UI's Toolbar.Separator. A separator carries the Separator role across the toolbar's cross axis and never takes focus, so arrow navigation steps straight past it.
Toolbar::separator
查看源码pub fn separator(self) -> ElementCreate the unstyled separator part. Use [`Self::separator_with`] to supply an existing element.
