shakeeb

image uploader

Forms 133

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

    300
  • Footer

    Footer

    168
  • Image Cropper

    Image Cropper

    60

More in Forms

View all
  • Premium Auth

    Premium Auth

    524
  • Contact Card

    Contact Card

    1K
  • Book A Demo 1

    Book A Demo 1

    73
  • Login 1

    Login 1

    53
  • Form

    Form

    137
  • Card Studio

    Card Studio

    41
  • SignInPage

    SignInPage

    667
  • Modern & Stunning sign in

    Modern & Stunning sign in

    1.6K