Angular ScrollView - Overview
The ScrollView is a UI component that enables a user to scroll its content.
The following code adds a simple ScrollView to your page. The width and height properties specify the UI component size. By default, the ScrollView allows a user to scroll its content vertically. To change this behavior, use the direction property. Note that horizontal scrolling appears only if the content is wider than the ScrollView. Otherwise, the content adapts to the width of the ScrollView.
- <dx-scroll-view
- [height]="500"
- [width]="500"
- direction="both"> <!-- or 'horizontal' | 'vertical' -->
- <!-- Here goes long content -->
- </dx-scroll-view>
- import { DxScrollViewModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxScrollViewModule
- ],
- // ...
- })
The ScrollView employs native scrolling on most platforms, except desktops. To employ it on all platforms without exception, assign true to the useNative property. Note that if you assign false to this property, the ScrollView will simulate scrolling on all platforms.
- <dx-scroll-view
- [useNative]="true">
- </dx-scroll-view>
- import { DxScrollViewModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxScrollViewModule
- ],
- // ...
- })
If simulated scrolling is used, you can specify when to show the scrollbar. For this purpose, use the showScrollbar property.
- <dx-scroll-view
- [useNative]="false"
- [showScrollbar]="always"> <!-- or 'onScroll' | 'onHover' | 'never' -->
- </dx-scroll-view>
- import { DxScrollViewModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxScrollViewModule
- ],
- // ...
- })
See Also
- Configure a UI Component: Angular | Vue | React | jQuery | AngularJS | Knockout
- ScrollView - Handle Scroll Gestures
- ScrollView - Scroll the Content
- ScrollView API Reference
If you have technical questions, please create a support ticket in the DevExpress Support Center.