Skip to content
Sign upGet access
MicrointeractionsPull refreshMenu

Pull refresh

Pull to refresh you can feel arming: a ring draws as you pull and closes at the line.

Pull the list down and it gives less the further you go; a ring draws round the arrow and, at the line, closes and turns blue. Let go and it spins, checks green and springs back.

Drag the list down from the top and it gives less the further you go. A ring draws round the arrow as you pull; at the line it closes, the arrow turns over and the ring takes colour, so you know letting go will do it. Let go and the ring spins while it loads, closes into a check and the list springs back up.

Installation

$ pnpm dlx shadcn@latest add https://chatcn.dev/r/pull-refresh.json

Usage

tsx
import { PullRefresh } from "@/components/ui/chatcn/pull-refresh"

<PullRefresh className="h-[480px]" onRefresh={() => refetch()}>
  <ThreadList />
</PullRefresh>

Pulling is a gesture, so keep a refresh control elsewhere for keyboard and screen reader users.

Props

PropTypeNotes
onRefresh() => Promise<unknown>The ring spins until it settles
thresholdnumberPx to pull before letting go refreshes. Default 72

Accessibility

  • Refreshing and Up to date are announced politely.

Motion

  • A tanh rubber band; the release rides a spring. Touch uses native listeners so normal scrolling is untouched.