# ngx-pull-to-refresh

> Pull to refresh component for Angular

Latest version **22.0.1** (published 2026-09-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-pull-to-refresh
pnpm add ngx-pull-to-refresh
yarn add ngx-pull-to-refresh
bun add ngx-pull-to-refresh
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 22.0.1 |
| Published | 2026-09-08 |
| First published | 2019-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 1 |
| Unpacked size | 52.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | YeongCheon Kim |
| Maintainers | yeongcheon |
| Keywords | angular, pull-to-refresh, refresh, infinite-scroll, mobile |

## Links

- npm: https://www.npmjs.com/package/ngx-pull-to-refresh
- Repository: https://github.com/YeongCheon/ngx-pull-to-refresh
- Homepage: https://github.com/YeongCheon/ngx-pull-to-refresh#readme
- Issues: https://github.com/YeongCheon/ngx-pull-to-refresh/issues
- npm.io page: https://npm.io/package/ngx-pull-to-refresh

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1

## Recent versions

- 22.0.1 (latest) — 2026-09-08
- 22.0.0 — 2026-09-08
- 20.0.0 — 2025-08-15
- 19.0.0 — 2025-02-16
- 18.1.2 — 2024-09-13
- 18.1.0 — 2024-07-28
- 17.0.0 — 2023-11-25
- 16.0.0 — 2023-05-06
- 15.0.2 — 2023-03-02
- 15.0.0 — 2022-12-13
- 14.0.0 — 2022-09-17
- 13.0.0 — 2021-12-20
- 11.1.21 — 2021-09-25
- 11.1.19 — 2021-07-01
- 11.1.18 — 2021-05-11
- … 52 more at https://npm.io/package/ngx-pull-to-refresh/versions

## README

# ngx-pull-to-refresh

An Angular pull-to-refresh component, similar to Android's
[SwipeRefreshLayout](https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout).
It also emits a `loadMore` event when the user scrolls near the end of the content,
so the same component covers pull-to-refresh and infinite scrolling.

## Installation

```bash
npm install ngx-pull-to-refresh
```

## Compatibility

| ngx-pull-to-refresh | Angular   |
|---------------------|-----------|
| 22.x                | >= 22     |
| 20.x                | 20 – 21   |
| 19.x                | 19        |
| 18.x                | ^18.1     |

## Usage

`NgxPullToRefreshComponent` is a standalone component, so add it to the `imports`
of whichever component uses it.

```typescript
import { Component, OnInit } from '@angular/core';
import { Subject } from 'rxjs';
import { NgxPullToRefreshComponent } from 'ngx-pull-to-refresh';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  imports: [NgxPullToRefreshComponent],
})
export class AppComponent implements OnInit {
  targetElement?: Element | null;

  ngOnInit(): void {
    this.targetElement = document.querySelector('html');
  }

  myRefreshEvent(event: Subject<void>, message: string): void {
    setTimeout(() => {
      alert(message);
      event.next(); // tell the component the refresh is done
    }, 3000);
  }

  alert(message: string): void {
    alert(message);
  }
}
```

```html
<ngx-pull-to-refresh
  spinnerColor="#ff0000"
  spinnerSize="50"
  distanceForRefresh="40"
  [isEnable]="true"
  [targetElement]="targetElement"
  (refresh)="myRefreshEvent($event, 'refresh')"
  (loadMore)="alert('loadmore')"
  style="display:block;height:100%;"
>
  <div style="height: 3000px">long content</div>
</ngx-pull-to-refresh>
```

The `refresh` output emits a `Subject`. The spinner keeps animating until you call
`next()` on it, so call it once your data has finished loading.

## Inputs

| Name                 | Type      | Default   | Description                                                                                             |
|----------------------|-----------|-----------|---------------------------------------------------------------------------------------------------------|
| `spinnerColor`       | `string`  | `#F7C223` | Refresh spinner color.                                                                                  |
| `spinnerSize`        | `number`  | `300`     | Refresh spinner size.                                                                                   |
| `distanceForRefresh` | `number`  | `40`      | Pull distance that triggers the `refresh` event.                                                        |
| `isEnable`           | `boolean` | `true`    | Enables or disables pull-to-refresh handling.                                                           |
| `isHorizontal`       | `boolean` | `false`   | Set to `true` for horizontally scrolling content. Pull-to-refresh is disabled, `loadMore` still fires.  |
| `customClass`        | `string`  | `''`      | CSS class applied to the inner `.ngx-ptr-content-container` element.                                    |
| `targetElement`      | `Element` | itself    | Normally not needed. Pass the scrolling element (e.g. `document.querySelector('html')`) if events do not fire. |

## Outputs

| Name       | Payload   | Description                                                                                       |
|------------|-----------|-----------------------------------------------------------------------------------------------------|
| `refresh`  | `Subject` | Fires when the pull distance exceeds `distanceForRefresh`. Call `next()` on the payload when done. |
| `loadMore` | `true`    | Fires when the content is scrolled past 85% of its scrollable length.                              |

## License

The MIT License (MIT)

Copyright (c) 2019 YeongCheon Kim

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
_Source: https://npm.io/package/ngx-pull-to-refresh · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
