TabContainer
A container that displays one content page at a time, where different pages can be selected via a set of tabs along the top. This is seen in some built-in plugins such as the Toolbox.
Dark | Light |
---|---|
This is a controlled component. The identifier of the selected tab should be passed to the
SelectedTab
prop, and a callback should be passed to the OnTabSelected
prop which is run
when the user selects a tab from the tab controls along the top.
The content rendered in each tab's main window should be passed to the children
parameters in
createElement
in the format described below. The keys are used as tab names
in the tab controls along the top and should also correspond to the identifier in SelectedTab
and the identifiers that OnTabSelected
prop may be called with. For example:
local function MyComponent()
local selectedTab, setSelectedTab = React.useState("Models")
return React.createElement(TabContainer, {
SelectedTab = selectedTab,
OnTabSelected = setSelectedTab,
}, {
["Models"] = {
LayoutOrder = 1,
Content = React.createElement(...),
},
["Decals"] = {
LayoutOrder = 2,
Content = React.createElement(...),
}
})
end
As well as disabling the entire component via the Disabled
CommonProp, individual
tabs can be disabled and made unselectable by passing Disabled
with a value of true
inside
the tab's entry in the Tabs
prop table.
info
The various tab containers found in Studio are inconsistent with each other (for example, Toolbox and Terrain Editor use different sizes, colors, and highlights). This design of this component uses the common elements of those designs and has small tweaks to stay consistent with the wider design of Studio elements.
Types
Tab
interface
Tab {
LayoutOrder:
number
Content:
React.ReactNode
Disabled:
boolean?
}
Props
Component Propsinterface
Props {
}