Progress Bar

@sme-uploader/progress-bar is a minimalist plugin that shows the current upload progress in a thin bar element, similar to the ones used by YouTube and GitHub when navigating between pages.

const ProgressBar = require('@sme-uploader/progress-bar');

uploader.use(ProgressBar, {
  // Options
});

Try it live

The @sme-uploader/drag-drop example uses a Progress Bar to show progress.

Installation

This plugin is published as the @sme-uploader/progress-bar package.

Install from NPM:

npm install @sme-uploader/progress-bar

In the CDN package, it is available on the SmeUploader global object:

const ProgressBar = SmeUploader.ProgressBar;

CSS

The @sme-uploader/progress-bar plugin requires the following CSS for styling:

import '@sme-uploader/core/dist/style.css';
import '@sme-uploader/progress-bar/dist/style.css';

Import general Core styles from @sme-uploader/core/dist/style.css first, then add the Informer styles from @sme-uploader/progress-bar/dist/style.css. A minified version is also available as style.min.css at the same path. The way to do import depends on your build system.

⚠️ If you use the @sme-uploader/dashboard plugin, you do not need to include the styles for the Progress Bar, because the Dashboard already includes it.

Options

The @sme-uploader/progress-bar plugin has the following configurable options:

uploader.use(ProgressBar, {
  target: '.UploadForm',
  fixed: false,
  hideAfterFinish: true
});

id: 'ProgressBar'

A unique identifier for this Progress Bar. It defaults to 'ProgressBar'. Use this if you need to add multiple ProgressBar instances.

target: null

DOM element, CSS selector, or plugin to mount the progress bar into.

fixed: false

When set to true, show the progress bar at the top of the page with position: fixed. When set to false, show the progress bar inline wherever it is mounted.

uploader.use(ProgressBar, {
  target: 'body',
  fixed: true
});

hideAfterFinish: true

When set to true, hides the progress bar after the upload has finished. If set to false, it remains visible.

replaceTargetContent: false

Remove all children of the target element before mounting the Progress Bar. By default, SME Uploader will append any UI to the target DOM element. This is the least dangerous option. However, you may have some fallback HTML inside the target element in case JavaScript or SME Uploader is not available. In that case, you can set replaceTargetContent: true to clear the target before appending.