Socket
Book a DemoInstallSign in
Socket

ngx-customscrollbar

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-customscrollbar

Pure ngx scrollbars without dependencies to jQuery or other scroll librarys, to bind customized scrollbars to every scrollable html element like scrollable div or textarea for example or a virtual view like a canvas

2.0.3
latest
Source
npmnpm
Version published
Maintainers
2
Created
Source

Ngx-CustomScrollbars

CodeFactor npm npm npm

Pure ngx scrollbars without dependencies to jQuery or other scroll librarys, to bind customized scrollbars to every scrollable html element like scrollable div or textarea for example or a virtual view like a canvas.

If you identify any errors in the library, or have an idea for an improvement, please open an issue or create a pull request.

Table of Contents

Installation

npm

npm i --save ngx-customscrollbar
# for angular 7
npm i --save ngx-customscrollbar@1.2.3

Usage

Import NgxCustomScrollbarModule in your module

import { NgxCustomScrollbarModule } from "ngx-customscrollbar";

@NgModule({
  imports: [
    // ...
    NgxCustomScrollbarModule
  ]
})

Vertical Scrollbar

Component

import { Component } from "@angular/core";
import { ViewportControl } from "ngx-customscrollbar";

@Component({
    selector: "app-vertical-scroll",
    templateUrl: "vertical-scroll.component.html",
    styleUrls: ["./vertical-scroll.component.scss"],
    viewProviders: [ViewportControl]
})
export class VerticalScrollComponent {
    // generate array with 300 items
    public items: Array<string | number> =
        Array.from({ length: 300 }, (val, index) => index);
}

Template

<div class="scrollWrapper">
  <div class="scrollView" ngxCustomScrollbarScrollable>
    <div *ngFor="let item of items">Lorem Ipsum {{item}}</div>
  </div>
  <ngx-customscrollbar></ngx-customscrollbar>
</div>

SCSS

@import "~ngx-customscrollbar/scss/common";
@import "~ngx-customscrollbar/scss/ngx-customscrollbars.theme"

.scrollWrapper {

  @include ngxCustomScrollbarsTheme();

  display: flex;
  flex-direction: row;
  height: 500px;
  overflow: hidden;

  .scrollView {
    flex: 1;
    overflow-y: auto;
  }
}

Horizontal Scrollbar

Component

import { Component } from "@angular/core";
import { ViewportControl } from "ngx-customscrollbar";


@Component({
    selector: "app-vertical-scroll",
    templateUrl: "vertical-scroll.component.html",
    styleUrls: ["./vertical-scroll.component.scss"],
    viewProviders: [ViewportControl]
})
export class VerticalScrollComponent {
    public items: Array<string | number> =
        Array.from({ length: 20 }, (val, index) => index);
}

Template

<div class="scrollWrapper">
  <div class="scrollView" ngxCustomScrollbarScrollable>
    <div *ngFor="let item of items">Lorem Ipsum {{item}}</div>
  </div>
  <ngx-customscrollbar [scrollDirection]="horizontal"></ngx-customscrollbar>
</div>

SCSS

@import "~ngx-customscrollbar/scss/common";
@import "~ngx-customscrollbar/scss/ngx-customscrollbars.theme"

.scrollWrapper {
  // load scrollbars theme here
  @include ngxCustomScrollbarsTheme();

  display: flex;
  flex-direction: row;
  height: 500px;
  overflow: hidden;

  .scrollView {
    flex: 1;
    overflow-x: auto;

    > div {
        white-space: nowrap;
        width: 4000px;
        display: flex;
        justify-content: space-between;

        &:after {
            content: "end of scroll";
        }
    }
  }
}

Docs

-Theming
-Directives

Author

Q2g - Ralf Hannuschka Github

Credit

  • Inspired by ngx-scrollbar

Keywords

scrollbar

FAQs

Package last updated on 12 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.