Skip to main content

Tabs

Panes switched on the client, each header a label on the theme's faces.

Tabs

Import​

import { Tabs } from '@bedrock-core/ore-styled';

Usage​

<Tabs width={280} height={140}>
<Tabs.Tab label={'Items'}>
<ItemList />
</Tabs.Tab>
<Tabs.Tab label={'Log'}>
<Log />
</Tabs.Tab>
</Tabs>

It is Tabs with the theme's tabs faces applied and a label in place of a drawn header. A chosen tab wears the pressed face and its label drops a pixel; labels are white whichever tab is chosen.

Switching tabs reaches no script and presents nothing again. A tab whose content depends on the switch is a screen change, not a tab.

Props​

Tabs​

PropTypeDefaultDescription
tabHeightnumberthe theme's tab heightHeight of the header row; the panes take what is left
tabBackgroundstringthe theme's normal faceThe face a header is drawn on while its tab is not chosen
tabHoverstringthe theme's hover faceThe face while the pointer is over a tab that is not chosen
tabSelectedstringthe theme's pressed faceThe face while its tab is the chosen one
gapSpacing-1Space between headers; -1 is the overlap that fuses adjacent borders

Inherits control props.

Tabs.Tab​

PropTypeDefaultDescription
label*DisplayText—The tab's name on its header
childrenJSX.Node—The pane shown while the tab is chosen

Examples​

A face of your own for the chosen tab​

<Tabs tabSelected={'textures/ui/my_tab_selected'} width={280} height={140}>
<Tabs.Tab label={'One'}>{first}</Tabs.Tab>
<Tabs.Tab label={'Two'}>{second}</Tabs.Tab>
</Tabs>

Notes​

The headers share the row's width evenly, so keep each label short enough to fit its share.

The theme's tabs section and its textures started as copies of the toggle buttons'.