TabPanel
A tabbed container that displays a collection of child panels, each accessible via a tab bar along the top. Each tab's appearance can be customized using the tab config on the child panel. Switch tabs programmatically with activeTab and listen for changes via the tabChange event. Tab selector buttons are fully keyboard-navigable — Enter or Space activates a tab.
const tabPanel = new TabPanel({
items : {
general : {
title : 'General',
items : {
name : { type : 'textfield', label : 'Name' }
}
},
settings : {
title : 'Settings',
tab : { icon : 'fa fa-cog' },
items : {
theme : { type : 'combo', label : 'Theme' }
}
}
},
appendTo : document.body
});
Useful configs and events
| Config / Event | Description |
|---|---|
| items | Tab child panels, keyed by tab reference name |
| activeTab | Index or reference of the initially active tab |
| tabMinWidth | Minimum width for tab selector buttons |
| animateTabChange | Animate transitions between tabs |
| tabChange | Fired when the active tab changes |
Adding non tab items to the tab bar
The TabBar is a subclass of the Toolbar, meaning you can add additional widgets to it. You can add either tab-specific items only shown for the active tab, or you can add static extra items that are shown for all tabs.
Demo showing tab-specific extra items using tabBarItems.
Demo showing static extra items using items
Tabs can be drag-dropped
You can easily let users reorder the tabs by setting enableReordering to true.
See also
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
The index of the initially active tab.
Has a corresponding runtime activeTab property.
-
Specifies whether to slide tabs in and out of visibility.
-
Set the height of all tabs to match the tab with the highest content.
-
Max width of a tab title. 0 means no maximum width. This is default.
-
Min width of a tab title. 0 means no minimum width. This is default.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of TabPanel class, or subclass thereof.