TabWidget
#
TabWidget
is a container for a set of tabs. It can only have Tab
elements as children and only one tab will be visible at
a time.
Properties#
content-min-width
andcontent-min-height
(out length): The minimum width and height of the contentscontent-width
andcontent-height
(out length): The width and height of the contentscontent-x
andcontent-y
(out length): The x and y position of the contentscurrent-focused
(in int): The index of the tab that has focus. This tab may or may not be visible.current-index
(in int): The index of the currently visible tabtabbar-preferred-width
andtabbar-preferred-height
(in length): The preferred width and height of the tab bartabbar-width
andtabbar-height
(out length): The width and height of the tab bartabbar-x
andtabbar-y
(out length): The x and y position of the tab bar
Properties of the Tab
element#
current-focused
(out int): The index of this tab that has focus at this time or -1 if none is focusedenabled
: (in bool): Defaults to true. When false, the tab can’t be activatedicon
(in image): The image on the tabnum-tabs
(out int): The number of tabs in the currentTabBar
tab-index
(out int): The index of this tabtitle
(in string): The text written on the tab
Example#
import { TabWidget } from "std-widgets.slint";
export component Example inherits Window {
width: 200px;
height: 200px;
TabWidget {
Tab {
title: "First";
Rectangle { background: orange; }
}
Tab {
title: "Second";
Rectangle { background: pink; }
}
}
}