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.
π StorybookPreviewβ
Live previewβ Open in Storybook
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β
| Prop | Type | Default | Description |
|---|---|---|---|
initialFiles | AttachmentFile[] | [] | 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 |
acceptedTypes | string[] | All types | MIME type filter |
maxFileSize | string | "50MB" | Maximum file size per file (e.g., "5MB") |
maxFiles | number | 10 | Maximum number of files |
disabled | boolean | false | Disables the dropzone |
sx | SxProps<Theme> | β | Root element style overrides |