---
title: "Pull to Refresh"
description: "A scroll area that people pull down at the top to load new content. A liquid drop stretches out of a handle, then turns into a spinner."
url: https://gelatinui.com/components/pull-to-refresh
markdown_url: https://gelatinui.com/components/pull-to-refresh.md
access: free
install: "npx shadcn@latest add @gelatin-ui/pull-to-refresh"
registry_item: https://gelatinui.com/r/pull-to-refresh.json
version: "2026-11-21"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Pull to Refresh

> A scroll area that people pull down at the top to load new content. A liquid drop stretches out of a handle, then turns into a spinner.

Page: https://gelatinui.com/components/pull-to-refresh

## When to use it

Best for: Lists and feeds on touch screens where people check for new items at the top.

- Use it on a list that people read from the top and that gets new items from a server.
- Return a promise from `onRefresh`: the spinner stays until it settles, and at least 700ms.
- Add `PullToRefreshTrigger` so keyboard, mouse, and agent users can refresh with no drag.

## When not to use it

- To load older items at the end of a list, use a [Button](https://gelatinui.com/components/button.md).
- To act on one row with a sideways swipe, use [Swipe Actions](https://gelatinui.com/components/swipe-actions.md).

## Notes for agents

- Put `PullToRefreshIndicator`, then the content in `PullToRefreshContent`, inside `PullToRefresh`. Give the root a height: it is the scroll area.
- A pull starts only when the area is scrolled to the top. Below the top, the finger scrolls the list as usual.
- `onRefresh` errors go to `onRefreshError`, or to `reportError` when it is not set. The spinner stops and the content springs back.
- `PullToRefreshLabel` shows its words for one `state`: `pulling`, `armed`, or `refreshing`.

## Anatomy

```text
PullToRefresh
├─ PullToRefreshIndicator (0..n)
├─ PullToRefreshLabel (0..n)
├─ PullToRefreshContent (0..n)
└─ PullToRefreshTrigger (0..n)
```

## API reference

### PullToRefresh

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onRefresh` | `function` |  | Runs on a refresh. Return a promise: the spinner stays until it settles. |
| `onRefreshError` | `function` |  | Gets what `onRefresh` threw or rejected with. Without it, the error goes to `reportError`. |
| `threshold` | `number` | PULL_TO_REFRESH.threshold | The pull in px that arms a refresh. Default 88. |
| `disabled` | `boolean` | false | No pull and no refresh. |

### PullToRefreshIndicator

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### PullToRefreshLabel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `state` | `"armed" \| "pulling" \| "refreshing"` |  | The state that shows this label. Put one label per state you want words for. |

### PullToRefreshContent

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### PullToRefreshTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| PullToRefresh | `pull-to-refresh` | `data-state` |  |  |
| PullToRefreshIndicator | `pull-to-refresh-indicator` |  |  |  |
| PullToRefreshLabel | `pull-to-refresh-label` | `data-visible` |  | `motion-timing` |
| PullToRefreshContent | `pull-to-refresh-content` |  |  |  |
| PullToRefreshTrigger | `pull-to-refresh-trigger` |  |  |  |

## Usage

Put the indicator and the content in the root, and give the root a height.

```tsx title="inbox.tsx"
import {
  PullToRefresh,
  PullToRefreshContent,
  PullToRefreshIndicator,
  PullToRefreshLabel,
  PullToRefreshTrigger,
} from "@/components/data/pull-to-refresh";

const MESSAGES = ["Launch moodboard", "Invoice #2048 is paid", "Design review notes"];

async function loadInbox() {
  await fetch("/api/inbox");
}

export function Inbox() {
  return (
    <PullToRefresh onRefresh={loadInbox} className="h-96">
      <PullToRefreshIndicator />
      <PullToRefreshLabel state="armed">Release to refresh</PullToRefreshLabel>
      <PullToRefreshContent>
        <ul className="px-4">
          {MESSAGES.map((message) => {
            return (
              <li key={message} className="py-3 text-sm">
                {message}
              </li>
            );
          })}
        </ul>
        <PullToRefreshTrigger variant="ghost" size="sm">
          Refresh
        </PullToRefreshTrigger>
      </PullToRefreshContent>
    </PullToRefresh>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

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

It adds 22 registry items: 19 files, 3899 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Swipe Actions](https://gelatinui.com/components/swipe-actions.md)
- [Scroll Area](https://gelatinui.com/components/scroll-area.md)
- [Spinner](https://gelatinui.com/components/spinner.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves to `PullToRefreshTrigger`, when the content has one. |
| Enter, Space | Runs the refresh from the trigger. The button is busy until it ends. |

## Motion

| Part | Motion |
| --- | --- |
| Pull | sheet · the content follows the finger on a rubber band, and a drop stretches out of the handle on a liquid neck |
| Armed | panel · at 88px the neck breaks with a small spring pop; a release now refreshes |
| Refreshing | progress · the drop opens into a ring, and a liquid head turns once each 900ms |
| Settle | sheet · the ring closes, the head spirals home into the handle, and the content springs back to rest |
