Angular TabPanel - Control the Behavior
An end user can switch the views by swiping them or selecting tabs. Note that tab navigation is always enabled, while swiping is active only on touch devices by default. To enable it on all types of devices, assign true to the swipeEnabled property. Otherwise, assign false.
- <dx-tab-panel
- [swipeEnabled]="false">
- </dx-tab-panel>
- import { DxTabPanelModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxTabPanelModule
- ],
- // ...
- })
You can switch the views progrmmatically using the selectedIndex or selectedItem property.
- <dx-tab-panel
- [(selectedIndex)]="selectedIndex">
- </dx-tab-panel>
- import { DxTabPanelModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- selectedIndex: number;
- constructor() {
- this.selectedIndex = 1;
- }
- }
- @NgModule({
- imports: [
- // ...
- DxTabPanelModule
- ],
- // ...
- })
The TabPanel can loop the views, which enables an end user to swipe through the last view to the first and vice versa. To enable this behavior, set the loop property to true.
- <dx-tab-panel
- [loop]="false">
- </dx-tab-panel>
- import { DxTabPanelModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxTabPanelModule
- ],
- // ...
- })
To specify whether or not to animate switching between views, use the animationEnabled property.
- <dx-tab-panel
- [animationEnabled]="true">
- </dx-tab-panel>
- import { DxTabPanelModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxTabPanelModule
- ],
- // ...
- })
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.