Docs
Upload Button

Upload Button

A simple upload button built over html input. If a file already exists, display the file and allows to remove or replace it.

Installation

pnpm dlx shadcn@bonjour

Usage

import {
  FileButton
} from "@/components/ui/file-button"
<FileButton
    // File to upload. Can be already defined
    value={file}
    // Called before the file is uploaded
    getUploadUrl={(file: SkovelFile) => FilesApi.getUploadURL(file)}
    // Called after the file is uploaded successfully to get the URL of the file in order to display it
    getDownloadUrl={async (file: SkovelFile) => FilesApi.getDownloadURL(file)}
    // Called after the file is uploaded successfully
    onChange={(file?: SkovelFile) => console.log(file)}
/>