Skip to main content

ButtonTabBar

The ButtonTabBar widget is a tab bar whose tabs appear as buttons.
Tap a tab to switch the screen or content.

info

Example file: 07_Work_with_Widgets/tabbar_buttontabbar_objet.lfp

Definition and role

The ButtonTabBar widget lays out button-shaped tabs, and lets you style the selected and unselected buttons differently. Tapping a tab runs the onChanged action and passes the selected index. It works the same as TabBar — only the look, a button style, differs.

  • Category: Contents
  • It contains three empty tabs when first placed.

Features

FeatureDescription
Tab switchingTapping a button tab changes the selection and runs onChanged.
Button stylesSet the decoration and label style separately for selected and unselected buttons.
Tab editing from a scriptAdd or replace tabs, and read labels, from a script.
Layout settingsAdjust the height, padding, spacing, alignment, transition duration, and more.

How to use

  1. Open the Contents category in the left widget palette.
  2. Drag and drop the ButtonTabBar item onto the canvas.
  3. Edit the labels in the tab list (tabs).
  4. Connect the action to run on a tab change to onChanged.
  5. If needed, adjust the selected and unselected button decorations (selectedDecoration and unselectedDecoration) along with the height and padding.

Properties

PropertyDescriptionDefaultValue / Type
indexCurrently selected tab0Integer
tabsTab list — each tab is a label3 empty tabsList
durationTab transition animation duration250Number (ms)
heightTab bar height46Number (px)
selectedDecorationDecoration of the selected buttonNot setDecoration
unselectedDecorationDecoration of unselected buttonsNot setDecoration
selectedLabelStyleStyle of the selected labelNot setText style
unselectedLabelStyleStyle of unselected labelsNot setText style
splashColorTouch splash colorNot setColor
contentPaddingPadding inside the buttonHorizontal 0Insets
buttonMarginMargin outside the button0Insets
labelSpacingGap between labels4Number
elevationShadow elevation0Number
centerCenter the tab barOff (false)true / false
lockScroll&expandButtonLock scrolling (expand the button width)Off (false)true / false
buttonLabelMainAxisAlignmentLabel alignment inside the buttonstartstart, end, center, spaceBetween, spaceAround, spaceEvenly

Notes and tips

tip

To make the selected and unselected states look different, set selectedDecoration (selected) and unselectedDecoration (unselected) separately.

tip

The behavior — tab switching and script control — is identical to TabBar. Use ButtonTabBar when you only need the button look.

Learn more

tip

For the full Widget Control (Property, Method, Event) you can use to drive this widget from a script, visit ButtonTabBar Widget Control.