Tabs
在带标签的面板之间切换,支持自动或手动键盘激活。
正在加载交互演示…
let tabs = Tabs::new("settings", "general");
tabs.root().flex_col().child(tabs.list().flex_row())#导入
从 quickgui 导入 Tabs。
use quickgui::*;#用法
let tabs = Tabs::new("settings", "general");
tabs.root().flex_col().child(tabs.list().flex_row())#结构
Tabs::rootTabs::listTabs::tabTabs::indicatorTabs::panel
#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
Tabs
查看源码pub fn new(root_id: impl Into<ElementId>, active: impl Into<ElementId>) -> Selfwithout_selectionpub fn without_selection(root_id: impl Into<ElementId>) -> Self—
Configures without selection for this part.
pub fn without_selection(root_id: impl Into<ElementId>) -> Self查看源码from_statepub fn from_state(root_id: impl Into<ElementId>, state: &TabsState) -> Self—
Configures from state for this part.
pub fn from_state(root_id: impl Into<ElementId>, state: &TabsState) -> Self查看源码orientationpub const fn orientation(mut self, orientation: TabsOrientation) -> Self—
Configures orientation for this part.
pub const fn orientation(mut self, orientation: TabsOrientation) -> Self查看源码verticalpub const fn vertical(self) -> Self—
activate_on_focuspub const fn activate_on_focus(mut self, activate_on_focus: bool) -> Self—
Activate an enabled tab as arrow/Home/End navigation moves focus to it. The default is manual activation: arrows move focus and Enter or Space invokes the tab's ordinary click listener.
pub const fn activate_on_focus(mut self, activate_on_focus: bool) -> Self查看源码loop_focuspub const fn loop_focus(mut self, loop_focus: bool) -> Self—
keep_mountedpub const fn keep_mounted(mut self, keep_mounted: bool) -> Self—
Retain inactive panels as `display: none` instead of omitting them from the mounted tree.
pub const fn keep_mounted(mut self, keep_mounted: bool) -> Self查看源码root_idpub const fn root_id(self) -> ElementId—
list_idpub fn list_id(self) -> ElementId—
active_valuepub const fn active_value(self) -> Option<ElementId>—
activates_on_focuspub const fn activates_on_focus(self) -> bool—
loops_focuspub const fn loops_focus(self) -> bool—
keeps_panels_mountedpub const fn keeps_panels_mounted(self) -> bool—
activation_movementpub const fn activation_movement(mut self, movement: TabsActivationMovement) -> Self—
Declare which way the selection travelled, for a descriptor built without a [`TabsState`].
pub const fn activation_movement(mut self, movement: TabsActivationMovement) -> Self查看源码activation_directionpub const fn activation_direction(self) -> TabsActivationDirection—
The side the selection last travelled toward, Base UI's `data-activation-direction`. A horizontal tab list reports `Left` or `Right`, a vertical one `Up` or `Down`, and both report `None` until the application selects through [`TabsState::select_at`].
pub const fn activation_direction(self) -> TabsActivationDirection查看源码indicator_geometrypub fn indicator_geometry( self, handle: &crate::AnchorPlacementHandle, ) -> Option<TabsIndicatorGeometry>—
Read back the active tab's laid-out geometry from a bound indicator handle. Mount the indicator with [`Tab::tracked_indicator_with`] and pass the same handle here on the next frame. The rectangle is the active tab's own, in window logical coordinates, and is `None` until the indicator has been painted once.
pub fn indicator_geometry( self, handle: &crate::AnchorPlacementHandle, ) -> Option<TabsIndicatorGeometry>查看源码tabpub fn tab(self, value: impl Into<ElementId>) -> Tab—
Tabs::root_with
查看源码pub fn root_with(self, root: Element) -> ElementDecorate an application-owned structural root without adding role or appearance.
Tabs::root
查看源码pub fn root(self) -> ElementCreate the unstyled root part. Use [`Self::root_with`] to supply an existing element.
Tabs::list_with
查看源码pub fn list_with(self, list: Element) -> ElementDecorate an application-owned tab-list root.
Tabs::list
查看源码pub fn list(self) -> ElementCreate the unstyled list part. Use [`Self::list_with`] to supply an existing element.
