shakeeb

image uploader

Forms 140

About

This is a reusable ImageUploadField React component built with Next.js and Tailwind CSS. It allows users to upload and preview an image with optional error display, loading skeleton, aspect ratio control, and size restriction. The component supports both file and URL inputs and provides clear UI feedback for upload state, errors, and removal actions. It’s designed to integrate cleanly with forms and supports customization via props like disabled, error, defaultImage, and maxSize.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds image uploader to your project and fits it to your theme.

Code

How image uploader is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import {useState } from "react";
import { ImageUploadField } from "@/components/ui/image-uploader.tsx";

const DemoOne = () => {
const [image,setImage]=useState()

  return (
    <ImageUploadField 
        value={image}
        onChange={setImage}
      //  error
       className="w-48"
      />
  )
};
// form component
//  <FormField
//   control={form.control}
//   name="photo"
//   render={({ field }) => (
//   <FormItem>
//   <FormLabel>Profile Picture</FormLabel>
//   <FormControl>
//   <FormControl>
//   <ImageUploadField
//       {...field}
//       error={!!form.formState.errors.photo?.message}
//       className="w-48"
//       />
//   </FormControl>
//   </FormControl>
//   <FormMessage />
//   </FormItem>
//   )}
//   />
export { DemoOne };

Dependencies

More by shakeeb

View all
  • Preloader

    Preloader

    310
  • Footer

    Footer

    168
  • Image Cropper

    Image Cropper

    78

More in Forms

View all
  • Form

    Form

    9
  • Contact Form

    Contact Form

    33
  • Contact Card

    Contact Card

    1.1K
  • Premium Auth

    Premium Auth

    615
  • Paper Plane

    Paper Plane

    113
  • Form

    Form

    18
  • Book A Demo 1

    Book A Demo 1

    95
  • Input

    Input

    14