Horje
Angular PrimeNG ScrollPanel Properties

Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. This article will show us how to use ScrollPanel Properties in Angular PrimeNG.

The ScrollPanel Component is a lightweight, cross-browser replacement to the built-in browser scrollbar.

Angular PrimeNG ScrollPanel Component Properties:

  • style: It is the inline style of the component. It is of string data type & the default value is null.
  • styleClass: It is the style class of the component. It is of string data type & the default value is null.

Creating Angular application & module installation:

Step 1: Create an Angular application using the following command.

ng new appname

Step 2: After creating your project folder i.e. appname, move to it using the following command.

cd appname

Step 3: Install PrimeNG in your given directory.

npm install primeng --save
npm install primeicons --save

Project Structure: It will look like the following:

 

Steps to run the above file: Run the below command to see the output

ng serve --save

Example 1: This basic example illustrates how to use the Angular PrimeNG ScrollPanel Properties using the vertical scrolling property.

  • app.component.html:

HTML

<h1 style="color: green">GeeksforGeeks</h1>
<h5>Angular PrimeNG ScrollPanel Vertical Scrolling Property</h5>
  
<p-scrollPanel [style]="{ height: '300px' }">
    <p>
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
    </p>
</p-scrollPanel>

  • app.component.ts:

Javascript

import { Component} from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
  
export class AppComponent { }

  • app.module.ts:

Javascript

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { AppComponent }   from './app.component';
import { ScrollPanelModule } from 'primeng/scrollpanel';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        ScrollPanelModule
    ],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
})
  
export class AppModule { }

Output:

Angular PrimeNG ScrollPanel Properties

Angular PrimeNG ScrollPanel Properties

Example 2: This is another basic example illustrating how to use the Angular PrimeNG ScrollPanel Properties using horizontal scrolling property.

  • app.component.html:

HTML

<h1 style="color: green">GeeksforGeeks</h1>
<h5>Angular PrimeNG ScrollPanel Properties</h5>
  
<p-scrollPanel [style]="{ height: '300px' }">
    <p style="width: 500px">
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
        GeeksforGeeks,
        It is a Computer Science Portal for all the geeks.
    </p>
</p-scrollPanel>

  • app.component.ts:

Javascript

import { Component} from '@angular/core';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.scss']
})
  
export class AppComponent { }

  • app.module.ts:

Javascript

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } 
    from '@angular/platform-browser/animations';
import { AppComponent }   from './app.component';
import { ScrollPanelModule } from 'primeng/scrollpanel';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        ScrollPanelModule
    ],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
})
  
export class AppModule { }

Output:

Angular PrimeNG ScrollPanel Properties

Angular PrimeNG ScrollPanel Properties

Reference: https://primefaces.org/primeng/scrollpanel




Reffered: https://www.geeksforgeeks.org


Technical Scripter

Related
Bootstrap 5 Modal getOrCreateInstance() Method Bootstrap 5 Modal getOrCreateInstance() Method
Bootstrap 5 Columns Breaks Bootstrap 5 Columns Breaks
AJAX Database Operations AJAX Database Operations
How To Troubleshoot and Fix Windows 10 Blue Screen Errors? How To Troubleshoot and Fix Windows 10 Blue Screen Errors?
Angular PrimeNG ConfirmPopup Properties Angular PrimeNG ConfirmPopup Properties

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
14