Skip to main content

Attachments

A file upload and attachment management component powered by FilePond. Supports drag-and-drop, image previews, PDF previews, file-type validation, and file-size limits.

πŸ“– Storybook

Preview​

Import​

import { Attachments } from "@xocialive/ui-components";

Basic usage​

<Attachments
onFilesChange={(files) => setAttachments(files)}
acceptedTypes={["image/*", "application/pdf"]}
maxFileSize="10MB"
/>

With existing files (edit mode)​

<Attachments
initialFiles={existingAttachments}
onFilesChange={(files) => setAttachments(files)}
onFileRemove={(fileId) => removeAttachment(fileId)}
/>

Props​

PropTypeDefaultDescription
initialFilesAttachmentFile[][]Pre-populated files (edit mode)
onFilesChange(files: File[]) => voidβ€”Called when the file list changes
onFileRemove(fileId: string) => voidβ€”Called when an existing file is removed
acceptedTypesstring[]All typesMIME type filter
maxFileSizestring"50MB"Maximum file size per file (e.g., "5MB")
maxFilesnumber10Maximum number of files
disabledbooleanfalseDisables the dropzone
sxSxProps<Theme>β€”Root element style overrides