Skip to content

Tabs

Tabs is a row of chips that switches between views. The row scrolls sideways when it does not fit.

Usage

Call Components.Tabs with a scope and a table of properties:

C.Tabs(scope, {
    Items = {
        { Id = "all", Label = "All" },
        { Id = "unread", Label = "Unread" },
    },
    OnChanged = function(id)
        print("Showing", id)
    end,
})

Properties

Name Type Required Default Description
Theme ThemeRef ❌ The contextual theme Theme to use for this component instead of the one from Theme.Provide.
LayoutOrder UsedAs<number> ❌ 0 Position in a parent UIListLayout or UIGridLayout.
Size UsedAs<UDim2> ❌ UDim2.new(1, 0, 0, 44) Size of the component.
Items { TabItem } ✅ - The tabs. Each has an Id and a Label.
Selected UsedAs<string> ❌ The first item Id of the selected tab. A plain value is only the starting tab. A Value is followed, and is set when the user picks one.
Id string ❌ - Key that identifies this component when state is kept across rebuilds. See Persist.

Callbacks

Name Description
OnChanged: (string) -> () Runs with the Id of the tab the user picked.

See also