BuzzForm
BuzzFormDocs

Upload Field

File upload field with support for Dropzone, Gallery, Inline, and Avatar variants.

Upload Field

The upload field allows users to upload one or more files with built-in validation for file size and quantity. It supports multiple presentation variants (Dropzone, Avatar, Inline, Gallery) and integrates seamless drag-and-drop support.

Schema Properties

Prop

Type

UI Options

OptionTypeDefaultDescription
variant"dropzone" | "avatar" | "inline" | "gallery""dropzone"Visual layout style
shape"circle" | "square" | "rounded""rounded"Shape preset for avatar or thumbnail previews
size"xs" | "sm" | "md" | "lg" | "xl""md"Size preset for avatar variant
acceptstring-Accepted MIME types / extensions (e.g. image/*, .pdf)
dropzoneTextstring-Overwrite the default dropzone placeholder text
classNamestring-CSS class applied to the field container
widthstring | number-Inline width applied to the field

Basic Usage

const schema = defineSchema({
  fields: [
    {
      type: "upload",
      name: "document",
      label: "Document Upload",
      description: "PDF, Word, or text files (max 10MB)",
      maxSize: 10 * 1024 * 1024,
      ui: {
        variant: "dropzone",
        accept: ".pdf,.doc,.docx,.txt",
      },
    },
  ],
});

Examples

Avatar Variant (Profile Picture)

{
  type: "upload",
  name: "avatar",
  label: "Profile Picture",
  ui: {
    variant: "avatar",
    shape: "circle",
    size: "lg",
    accept: "image/*",
  },
}
{
  type: "upload",
  name: "images",
  label: "Product Images",
  hasMany: true,
  max: 6,
  ui: {
    variant: "gallery",
    accept: "image/*",
  },
}

Inline Variant (Simple Button & Pills)

{
  type: "upload",
  name: "attachment",
  label: "Email Attachment",
  ui: {
    variant: "inline",
    accept: "image/*,application/pdf",
  },
}

Auto-Derived Validators

PropertyValidatorDescription
required: truerequiredFile must be uploaded
minminSelectedMinimum number of files (when hasMany is true)
maxmaxSelectedMaximum number of files (when hasMany is true)
maxSizemaxSizeMaximum file size in bytes

On this page