Pills
Angular Bootstrap 5 Pills component
Pills are quasi-navigation components which can highly improve website clarity and increase user experience.
Note: Read the API tab to find all available options and advanced customization
Basic example
Use [pills]="true"
input to change from tabs layout to pills layout.
Fill and justify
Force the contents of your tab to extend the full available width using following settings.
Fill
To proportionately fill all available space, use
[fill]="true"
input. Notice that all horizontal space is occupied, but not
every nav item has the same width.
Justify
For equal-width elements, use [justified]="true"
input. All horizontal space
will be occupied by nav links, but unlike the [fill]="true"
above, every nav
item will be the same width.
Vertical
Use [vertical]="true"
input to change the layout direction.
Custom title template
If you need to add a title that is more complex than simple string, use
ng-template
with mdbTabTitle
directive.
Pills with icons
Use one of 1541 icons and add it to the pills. See the icon docs to explore all the available icons.
Lazy loading
You can use ng-template
with mdbTabContent
directive to lazy load
tab content. The content will be loaded only when tab is activated.
Pills - API
Import
Inputs
MdbTabComponent
Name | Type | Default | Description |
---|---|---|---|
disabled
|
boolean | false |
Disables the specific tab. |
title
|
string | '' |
Changes title of the tab. |
MdbTabsComponent
Name | Type | Default | Description |
---|---|---|---|
fill
|
boolean | false |
Forces tabs content to extend the full available width. |
justified
|
boolean | false |
Makes all tabs equal width and forces them to take full available width. |
pills
|
boolean | false |
Changes to pills layout. |
vertical
|
boolean | false |
Changes to vertical layout. |
Outputs
Name | Type | Description |
---|---|---|
activeTabChange
|
EventEmitter<MdbTabChange> | Event fired when active tab changes. |
Methods
Name | Description | Example |
---|---|---|
setActiveTab(index: number)
|
Set desired tab as active | tabs.setActiveTab(1) |
CSS variables
As part of MDB’s evolving CSS variables approach, pills now use local CSS variables for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.
Pills CSS variables are in different classes which belong to this component. To make it easier to use them, you can find below all of the used CSS variables.