Pull to Refresh

Wrap a scrollable feed to get the gesture from native apps: dragging down from the top meets growing resistance, the indicator shows pull, release and refreshing states, and onRefresh can return a promise that keeps the spinner up until it resolves. Mouse drags work too.

Preview

Pull to Refresh preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/pull-to-refresh
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

onRefresh
() => void | Promise<void>

Runs after the user pulls beyond the threshold and releases.

—
refreshing?
boolean

Keeps the indicator active while an externally managed refresh runs.

false
disabled?
boolean
false
threshold?
number

Resisted pull distance in pixels required to refresh.

76
maxPull?
number

Maximum resisted pull distance in pixels.

132
holdDistance?
number

Content offset in pixels while refreshing.

68
pullingLabel?
ReactNode
Pull to refresh
releaseLabel?
ReactNode
Release to refresh
refreshingLabel?
ReactNode
Refreshing
ariaLabel?
string
Refreshable content
className?
string
—
contentClassName?
string
—
indicatorClassName?
string
—

Updated