Skip to content

TabLayout

Organises content into switchable tabs.

TabLayout.builder()
.tabs(List.of(
Tab.builder()
.label("General")
.content(generalContent)
.build(),
Tab.builder()
.label("Settings")
.content(settingsContent)
.build()
))
.build()
PropertyTypeDefaultDescription
idString—Optional component ID
tabsList<Tab>—Tab definitions
orientationOrientation—horizontal (default) or vertical
variantTabLayoutVariant—Visual style variant
styleString—Inline CSS
cssClassesString—CSS class names
PropertyTypeDefaultDescription
labelString—Tab header label
contentComponent—Tab body content
badgeString—Small chip next to the label (a count, a status)
activebooleanfalseWhether this tab is initially selected
shortcutString—Keyboard shortcut that selects the tab (alt+1)
TabLayout.builder()
.orientation(Orientation.vertical)
.tabs(List.of(
Tab.builder().label("Profile").content(profileForm).build(),
Tab.builder().label("Security").content(securityForm).build()
))
.build()

A tab’s header is its text label, optionally with a small badge (a count, a status):

TabLayout.builder()
.tabs(List.of(
Tab.builder()
.label("Orders")
.badge("12")
.content(ordersGrid)
.active(true)
.build(),
Tab.builder()
.label("Invoices")
.content(invoicesGrid)
.build()
))
.build()

See it live in the Explorer: Tabs, accordions & carousel