DevExtreme Angular - 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 option. 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 option.
- <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. Views are looped by default. To disable looping, assign false to the loop option.
- <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 option.
- <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.