Skip to content

BbDropzone

Capture and validate files while the application owns errors, upload progress, cancellation, and retry.

import { BbDropzone } from 'bitboss-ui';

On this page

Use it for

Use BbDropzone when users need a visible drop target, picker access, and file validation.

Use something else when

  • <input type="file"> — one picker with no drop surface or rendered selection is enough
  • BbProgress — the task is showing an upload already in progress

Pass Through

Hover or tap a part to outline it. Toggles flip loading, errors and warnings when the component has them — only parts highlight.

BbDropzone captures and validates files. It does not upload them.

Validate receipt attachments

Put type, size, count, and duplicate rules at the boundary, then translate each typed rejection into application copy.

Rejected files never enter the model. The error event does not fill errors for you: map its discriminated payload and pass the message back so it is announced in context.

Model and file constraints

multiple changes both behavior and type: single mode replaces File | null; multiple mode appends to a seeded File[].

File | null → null

File[] → []

Apply accept to picker and drop paths. Pair MIME types with extensions when operating systems may omit file.type.

max-size is bytes per file. max-files counts the existing and incoming selection. The model always contains validated files only.

Own the drop surface

The default slot is the visible surface. Put labelId on its headline only, not on a wrapper that also contains hints, buttons, and filenames.

Use the slot's dragging and focused flags for state, and open() for a visible Browse button. Do not nest another label; the slot already renders inside one.

Upload and submit

Build FormData from the model and keep progress, cancellation, retry, and server errors in application state.

Already on file

  • Q2 revenue review.pdf2.4 MB
  • Supplier contract — Aeris.pdf795.8 KB

Set name only for a native multipart post. In v3, the hidden submittable input exists only when name is present; v2 rendered it unconditionally.

Unsupported field states

Disable the zone while an upload is active so the selection cannot change mid-request.

There is no readonly, loading, compact, or adaptive overlay. Render a read-only file list yourself, pair active transfers with BbProgress, and let mobile use the native operating-system picker.