skip to Main Content

I followed the instructions on the page https://docs.uploadthing.com/nextjs/pagedir to upload images to uploadthing.com, and everything is working fine. Now I want to customize the upload button, so how can I do that?
Below is the code in my application:

import { UploadButton } from "~/utils/uploadthing";
 
export default function Home() {
  return (
    <main className="flex min-h-screen flex-col items-center justify-between p-24">
      <UploadButton
        endpoint="imageUploader"
        onClientUploadComplete={(res) => {
          // Do something with the response
          console.log("Files: ", res);
          alert("Upload Completed");
        }}
        onUploadError={(error: Error) => {
          // Do something with the error.
          alert(`ERROR! ${error.message}`);
        }}
      />
    </main>
  );
}

Example: Can I replace the upload button with an image or SVG? If yes, how can I do that?

2

Answers


  1. To do so, you need to update your UploadButton component. You can add svg or progressbars or anything you like.

    Login or Signup to reply.
  2. I would suggest you to use React Uploady. The tutorial you are using is very much dependent on the library and lot of details are encapsulated.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search