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 and content-min-height (out length): The minimum width and height of the contents

  • content-width and content-height (out length): The width and height of the contents

  • content-x and content-y (out length): The x and y position of the contents

  • current-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 tab

  • tabbar-preferred-width and tabbar-preferred-height (in length): The preferred width and height of the tab bar

  • tabbar-width and tabbar-height (out length): The width and height of the tab bar

  • tabbar-x and tabbar-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 focused

  • enabled: (in bool): Defaults to true. When false, the tab can’t be activated

  • icon (in image): The image on the tab

  • num-tabs (out int): The number of tabs in the current TabBar

  • tab-index (out int): The index of this tab

  • title (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; }
        }
    }
}