React Pull Refresh

A beautiful, customizable React component for pull-to-refresh functionality with smooth Material Design animations. Perfect for mobile and desktop applications.

✨ Features

📱

Touch & Mouse Support

Works seamlessly on both mobile touch devices and desktop with mouse interactions.

🎨

Material Design

Beautiful Material Design animations with customizable colors and smooth transitions.

High Performance

Optimized for performance with efficient rendering and smooth 60fps animations.

🔧

Fully Customizable

Customize colors, thresholds, animations, and behavior to match your app's design.

📦

Lightweight

Small bundle size with tree-shaking support. Only includes what you need.

🎯

TypeScript Ready

Full TypeScript support with comprehensive type definitions included.

📦 Installation

Install React Pull to Refresh using your favorite package manager:

npm

Terminal
npm install react-material-pull-to-refresh

yarn

Terminal
yarn add react-material-pull-to-refresh

pnpm

Terminal
pnpm add react-material-pull-to-refresh

Peer Dependencies: React 16.8+ and React DOM 16.8+ are required.

🚀 Usage

Basic Usage
React Component
import React from 'react';
import PullToRefresh from 'react-material-pull-to-refresh';

function App() {
  const handleRefresh = async () => {
    // Your refresh logic here
    await fetchNewData();
  };

  return (
    <PullToRefresh onRefresh={handleRefresh}>
      <div>
        <!-- Your content here -->
        <h1>Pull down to refresh</h1>
        <p>Content goes here...</p>
      </div>
    </PullToRefresh>
  );
}
Advanced Configuration
React Component
<PullToRefresh
  onRefresh={handleRefresh}
  threshold={100}
  maxPull={200}
  color="#ff6b6b"
  backgroundColor="#f8f9fa"
>
  <YourContent />
</PullToRefresh>

📚 API Reference

Prop Type Default Description
children ReactNode - The content to wrap with pull-to-refresh functionality
onRefresh () => Promise<void> () => Promise.resolve() Function called when refresh is triggered
threshold number 80 Distance in pixels to trigger refresh
maxPull number 180 Maximum pull distance allowed
color string '#2563eb' Color of the spinner and arrow
backgroundColor string '#ffffff' Background color of the indicator bubble