Skip to content

Upload

Drag-and-drop file picker with previews and validation.

Installation

bun add @xerobi/ui
import { DeleteButton, MultiFilePreview, RejectionFiles, SingleFilePreview, Upload, UploadAvatar, UploadBox, UploadPlaceholder } from "@xerobi/ui/upload"

This component is client-side. In Astro, hydrate it with a client directive.

API reference

DeleteButton

Also accepts every prop of <button> element.

No props of its own.

MultiFilePreview

PropTypeDescription
files*(string | File)[]
lastNodestring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
firstNodestring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
onRemove(file: string | File) => void
thumbnailboolean
slotProps{ thumbnail?: Omit<FileThumbnailProps, "file"> | undefined; }

RejectionFiles

PropTypeDescription
filesreadonly FileRejection[]

SingleFilePreview

PropTypeDescription
file*string | File

Upload

PropTypeDescription
errorboolean
classNamestring
thumbnailboolean
helperTextstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
placeholderstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
valuestring | File | FilesUploadType
onDelete() => void
onUpload() => void
onRemoveAll() => void
onRemove(file: string | File) => void
labels{ removeAll?: string | undefined; upload?: string | undefined; updatePhoto?: string | undefined; uploadPhoto?: string | undefined; }

UploadAvatar

PropTypeDescription
errorboolean
classNamestring
thumbnailboolean
helperTextstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
placeholderstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
valuestring | File | FilesUploadType
onDelete() => void
onUpload() => void
onRemoveAll() => void
onRemove(file: string | File) => void
labels{ removeAll?: string | undefined; upload?: string | undefined; updatePhoto?: string | undefined; uploadPhoto?: string | undefined; }

UploadBox

PropTypeDescription
errorboolean
classNamestring
thumbnailboolean
helperTextstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
placeholderstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
valuestring | File | FilesUploadType
onDelete() => void
onUpload() => void
onRemoveAll() => void
onRemove(file: string | File) => void
labels{ removeAll?: string | undefined; upload?: string | undefined; updatePhoto?: string | undefined; uploadPhoto?: string | undefined; }

UploadPlaceholder

PropTypeDescription
labels{ title?: string | undefined; before?: string | undefined; link?: string | undefined; after?: string | undefined; }

Search documentation

Search pages, components and blocks.