React Picture Selector

Installation Guide

Learn about the main capabilities of React Picture Selector and how to install it in your project.

React Picture Selector provides a complete solution for handling image uploads with a modern and responsive interface. It supports both drag-and-drop and traditional selection methods, offering real-time progress indication through a smooth progress ring or percentage display. Animations are optimized with requestAnimationFrame, ensuring fluid transitions and minimal CPU consumption even on lower-end devices. Upload operations can be safely canceled using the built-in AbortController, providing users with full control over the process.


Installation Steps

npm install react-picture-selector

Dependencies

  • React (for component rendering and state management)
  • Axios (for making API requests in real mode)

Required Dependencies

The component requires these peer dependencies to be installed in your project:

Basic Setup

import PictureSelector from "react-picture-selector";
import { useState } from "react";

function ProfilePage() {
  const [currentImage, setCurrentImage] = useState("https://example.com/avatar.jpg");

  const handleImageChange = (imageUrl: string, responseData?: any) => {
    setCurrentImage(imageUrl);
    console.log("API Response:", responseData);
  };

  return (
    <PictureSelector
      imageUrl={currentImage}
      onChangeImage={handleImageChange}
      type="profile"
      title="Profile Photo"
      size={150}
    />
  );
}

Ready to Use

Your React Picture Selector is now installed and ready! Continue to the next section to explore advanced configuration options.