TabView

TabView is a container for a set of tab items.

Properties

  • current_item (in_out int): The index of the currently active item.
  • current_value (out TabItem): The current selected tab item.
  • model (out [TabItem]): The model of items.
  • enabled (in bool): True if the list view is enabled.
  • tab_bar_position (in Position): Defines the position of the tab bar (default top).

Functions

  • set_current_item(current_item: int): Sets the current item by the specified index.

Callbacks

  • current_item_changed(/* current_item */ int): Emitted when the current item has changed because the user modified it.
  • close(/* index */ int): Emitted when the the given item is requested to be closed.

Example

import { TabView } from "@coop/lib.slint";

export component Example inherits Window {
    width: 150px;
    height: 150px;

    i_tab_view := TabView {
        width: 150px;
        height: 150px;

        model: [
            { text: "Tab 1" },
            { text: "Tab 2" },
            { text: "Tab 3" },
        ];

        Text {
            text: i_tab_view.current_value.text;
        }
    }
}