Skip to content
BigBang

Popular

    ↑↓Navigate↵OpenEscClose
    TR

    Components

    FileDropzone

    A drop area for files, with a file chooser and a list of the chosen files.

    Storybook
    Storybook
    Source
    Source

    The example below loads live from Storybook; open it there to use the controls.

    Live example, StorybookOpen in Storybook

    Drag files onto the zone or click it. accept, maxSize and multiple apply rules; rejected files get a message.

    Drag files here or

    PDF or image, up to 2 MB each.

    import { FileDropzone, Provider } from '@bigbang/ui';
    export default function Default() {
    return (
    <Provider locale="en-GB">
    <FileDropzone label="Documents" description="PDF or image, up to 2 MB each." accept="application/pdf,image/*" maxSize={2_000_000} multiple className="max-w-md" />
    </Provider>
    );
    }

    Without multiple, a new file replaces the old one.

    Drag files here or

    PNG or JPG, up to 1 MB.

    import { FileDropzone, Provider } from '@bigbang/ui';
    export default function Single() {
    return (
    <Provider locale="en-GB">
    <FileDropzone label="Profile photo" description="PNG or JPG, up to 1 MB." accept="image/png,image/jpeg" maxSize={1_000_000} className="max-w-md" />
    </Provider>
    );
    }

    Required with an error, disabled.

    Drag files here or

    Add at least one document.

    Drag files here or

    PDF or image, up to 2 MB each.

    import { FileDropzone, Provider } from '@bigbang/ui';
    export default function States() {
    return (
    <Provider locale="en-GB">
    <div className="flex max-w-md flex-col gap-xl">
    <FileDropzone label="Documents" error="Add at least one document." required />
    <FileDropzone label="Documents" description="PDF or image, up to 2 MB each." disabled />
    </div>
    </Provider>
    );
    }

    fileStatus returns the upload state of each file: uploading (a progress bar from progress), done (a check mark) or error (a message). With onRetry, a retry button appears next to a failed file.

    Live example, StorybookOpen in Storybook

    While dragging, the zone takes the primary border and the selected surface.

    Drag files here or

    PDF or image, up to 2 MB each.

    Drag files here or

    PDF or image, up to 2 MB each.

    import { FileDropzone, Provider } from '@bigbang/ui';
    export default function Default() {
    return (
    <Provider locale="en-GB">
    <FileDropzone label="Documents" description="PDF or image, up to 2 MB each." accept="application/pdf,image/*" maxSize={2_000_000} multiple className="max-w-md" />
    </Provider>
    );
    }