---
title: "Pull to Refresh"
description: "Native-feeling pull-to-refresh container with drag resistance, threshold feedback and async refresh handling."
category: "Components"
publishedAt: "2026-07-17"
updatedAt: "2026-11-10"
documentation: "https://beui.dev/components/motion/pull-to-refresh"
markdown: "https://beui.dev/components/motion/pull-to-refresh.md"
license: "MIT"
---

# Pull to Refresh

> Native-feeling pull-to-refresh container with drag resistance, threshold feedback and async refresh handling.

## Install

```bash
npx shadcn@latest add @beui/pull-to-refresh
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { Bell, CheckCircle2, GitPullRequest, MessageCircle } from "lucide-react";
import { useState } from "react";
import { PullToRefresh } from "@/components/motion/pull-to-refresh";

const initialUpdates = [
  {
    id: 1,
    icon: GitPullRequest,
    title: "Motion review approved",
    detail: "The pull request is ready to merge.",
    time: "4m",
  },
  {
    id: 2,
    icon: MessageCircle,
    title: "New component feedback",
    detail: "The spring feels much closer to native now.",
    time: "18m",
  },
  {
    id: 3,
    icon: CheckCircle2,
    title: "Registry checks passed",
    detail: "All component files resolved successfully.",
    time: "31m",
  },
  {
    id: 4,
    icon: Bell,
    title: "Preview deployed",
    detail: "The latest build is ready to inspect.",
    time: "1h",
  },
  {
    id: 5,
    icon: MessageCircle,
    title: "Docs comment resolved",
    detail: "The usage example now covers async refreshes.",
    time: "2h",
  },
] as const;

export function PullToRefreshPreview() {
  const [refreshCount, setRefreshCount] = useState(0);
  const [latestUpdate, setLatestUpdate] = useState<number | null>(null);

  const updates = latestUpdate
    ? [
        {
          id: latestUpdate,
          icon: Bell,
          title: "You’re all caught up",
          detail: "The activity feed was refreshed just now.",
          time: "now",
        },
        ...initialUpdates,
      ]
    : initialUpdates;

  return (
    <div className="flex min-h-[34rem] w-full items-center justify-center p-4">
      <div className="w-full max-w-sm overflow-hidden rounded-3xl border border-border bg-background shadow-2xl">
        <PullToRefresh
          ariaLabel="Activity feed"
          className="h-[30rem]"
          onRefresh={async () => {
            await new Promise((resolve) => setTimeout(resolve, 900));
            const next = refreshCount + 1;
            setRefreshCount(next);
            setLatestUpdate(Date.now());
          }}
        >
          <header className="sticky top-0 z-10 flex items-center justify-between border-b border-border bg-background/90 px-5 py-4 backdrop-blur-md">
            <div>
              <p className="font-medium text-foreground">Activity</p>
              <p className="text-xs text-muted-foreground">
                Pull down to check for updates
              </p>
            </div>
            <span className="rounded-full bg-muted px-2.5 py-1 font-mono text-[11px] text-muted-foreground">
              {refreshCount ? `${refreshCount} refreshed` : "live"}
            </span>
          </header>

          <div className="divide-y divide-border px-2 pb-3">
            {updates.map((update) => {
              const Icon = update.icon;

              return (
                <article key={update.id} className="flex gap-3 px-3 py-4">
                  <div className="grid h-9 w-9 shrink-0 place-items-center rounded-full border border-border bg-card text-muted-foreground shadow-sm">
                    <Icon className="h-4 w-4" />
                  </div>
                  <div className="min-w-0 flex-1">
                    <div className="flex items-start justify-between gap-3">
                      <p className="text-sm font-medium text-foreground">
                        {update.title}
                      </p>
                      <span className="shrink-0 font-mono text-[11px] text-muted-foreground">
                        {update.time}
                      </span>
                    </div>
                    <p className="mt-1 text-xs leading-relaxed text-muted-foreground">
                      {update.detail}
                    </p>
                  </div>
                </article>
              );
            })}
          </div>
        </PullToRefresh>
      </div>
    </div>
  );
}
```

## API Reference

### PullToRefresh

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `onRefresh` | `() => void \| Promise<void>` |  | Yes | Runs after the user pulls beyond the threshold and releases. |
| `refreshing` | `boolean` | `false` | No | Keeps the indicator active while an externally managed refresh runs. |
| `disabled` | `boolean` | `false` | No | Turns off the pull gesture. Default: false |
| `threshold` | `number` | `76` | No | Resisted pull distance in pixels required to refresh. |
| `maxPull` | `number` | `132` | No | Maximum resisted pull distance in pixels. |
| `holdDistance` | `number` | `68` | No | Content offset in pixels while refreshing. |
| `pullingLabel` | `ReactNode` |  | No | Indicator text while pulling, short of the threshold. Default: "Pull to refresh" |
| `releaseLabel` | `ReactNode` |  | No | Indicator text once past the threshold. Default: "Release to refresh" |
| `refreshingLabel` | `ReactNode` |  | No | Indicator text while refreshing. Default: "Refreshing" |
| `ariaLabel` | `string` |  | No | Accessible name for the scroll region. Default: "Refreshable content" |
| `labels` | `Partial<{ pulling: string; release: string; refreshing: string; label: string; }>` |  | No | Override any built-in string. |
| `className` | `string` |  | No | Classes merged onto the scroll container. |
| `contentClassName` | `string` |  | No | Classes merged onto the element that wraps the children and moves with the pull. |
| `indicatorClassName` | `string` |  | No | Classes merged onto the indicator at the top. |

## About Pull to Refresh

Pull to Refresh is a native-feeling pull-to-refresh container for React built with Framer Motion and Tailwind CSS. When the content is scrolled to the top, pulling down drags it with increasing resistance, a small indicator reacts to the pull, and its label changes once the threshold is reached. Releasing past the threshold runs your async refresh and holds the content open until it finishes. It works with touch, mouse and pen.

### When to use it

- A mobile web feed, inbox or timeline should refresh with the same pull gesture people use in native apps.
- A dashboard panel or list inside a scrolling container needs a gesture to reload its data.
- A progressive web app wants refresh behavior that waits for a network request before settling back.

### Accessibility

The container is a labelled section that sets aria-busy while a refresh runs. The status label, which reads pull, release or refreshing, sits in a polite live region so screen readers hear the state change, and the decorative indicator is hidden from assistive technology. With reduced motion enabled, the content no longer moves with the pull, the indicator fades instead of scaling, and the refreshing animation becomes a calm pulse.

### FAQ

**How do I add pull to refresh in React?**

Wrap your scrollable content in PullToRefresh and pass an onRefresh function. If it returns a promise, the indicator stays in its refreshing state until the promise settles.

**Can I change how far the user has to pull?**

Yes. threshold sets the resisted pull distance in pixels needed to refresh, maxPull caps how far the content can travel, and holdDistance sets the offset held while refreshing.

**Can I change the pull to refresh text?**

Yes. Use pullingLabel, releaseLabel and refreshingLabel for the three states, and ariaLabel to name the region. Set refreshing to keep the indicator active during a refresh you manage elsewhere.

## Source

- Registry detail: https://beui.dev/r/pull-to-refresh
- Raw source: https://beui.dev/r/pull-to-refresh/raw
- GitHub: https://github.com/starc007/ui-components
