Component

Pull to Refresh

Drag down from the top of a scrollable area to trigger a refresh — a touch gesture that lives beside native scrolling.

Installation

import { WrPullToRefresh } from 'ngwr/pull-to-refresh';

@Component({ imports: [WrPullToRefresh] })
export class MyComponent {}

Basic

Pull down from the very top on a touch device and release past the threshold to fire refresh; a light haptic tap marks the arming point. It's a controlled spinner — bind refreshing and clear it when the work settles. No touch device handy? The button drives the same refreshing state programmatically.

<wr-pull-to-refresh
  style="height: 16rem"
  [refreshing]="loading()"
  (refresh)="reload()"
>
  @for (item of items(); track item) {
    <div class="row">{{ item }}</div>
  }
</wr-pull-to-refresh>
protected readonly loading = signal(false);

reload(): void {
  this.loading.set(true);
  this.api.fetch().subscribe((rows) => {
    this.items.set(rows);
    this.loading.set(false);   // clearing `refreshing` closes the indicator
  });
}
Refresh programmatically
Aurora
Borealis
Cascade
Drift
Ember
Fathom

API

NameDescriptionTypeDefault
refreshingWhether a refresh is in flight — drives the spinner. Set true in refresh, false when it resolves.booleanfalse
thresholdPull distance (px) a release must reach to trigger.number64
disabledDisable the gesture entirely.booleanfalse
(refresh)Fires when the user pulls past threshold and releases.void