progress-bar.mdx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ---
  2. sidebar_position: 5
  3. slug: /progress-bar
  4. ---
  5. import Tabs from '@theme/Tabs';
  6. import TabItem from '@theme/TabItem';
  7. import UppyCdnExample from '/src/components/UppyCdnExample';
  8. # Progress bar
  9. `@uppy/progress-bar` is a minimalist plugin that shows the current upload
  10. progress in a thin bar element, like the ones used by YouTube and GitHub when
  11. navigating between pages.
  12. ## When should I use it?
  13. When you need a minimalistec progress indicator and you’re
  14. [building your own UI](/docs/guides/building-your-own-ui-with-uppy). For most
  15. cases, [Dashboard](/docs/dashboard) or [Drag & Drop](/docs/drag-drop) (with
  16. [Status Bar](/docs/status-bar)) is more likely what you need.
  17. ## Install
  18. <Tabs>
  19. <TabItem value="npm" label="NPM" default>
  20. ```shell
  21. npm install @uppy/progress-bar
  22. ```
  23. </TabItem>
  24. <TabItem value="yarn" label="Yarn">
  25. ```shell
  26. yarn add @uppy/progress-bar
  27. ```
  28. </TabItem>
  29. <TabItem value="cdn" label="CDN">
  30. <UppyCdnExample>
  31. {`
  32. import { Uppy, ProgressBar } from "{{UPPY_JS_URL}}"
  33. const uppy = new Uppy()
  34. uppy.use(ProgressBar, { target: '#progress-bar' })
  35. `}
  36. </UppyCdnExample>
  37. </TabItem>
  38. </Tabs>
  39. ## Use
  40. ```js
  41. import Uppy from '@uppy/core';
  42. import ProgressBar from '@uppy/progress-bar';
  43. import '@uppy/core/dist/style.min.css';
  44. import '@uppy/progress-bar/dist/style.min.css';
  45. new Uppy().use(ProgressBar, { target: '#progress-bar' });
  46. ```
  47. ## API
  48. ### Options
  49. #### `id`
  50. A unique identifier for this Progress Bar (`string`, default: `'ProgressBar'`).
  51. Use this if you need to add several ProgressBar instances.
  52. #### `target`
  53. DOM element, CSS selector, or plugin to mount the Progress Bar into (`Element`,
  54. `string`, default: `null`).
  55. #### `fixed`
  56. Show the progress bar at the top of the page with `position: fixed` (`boolean`,
  57. default: `false`).
  58. When set to false, show the progress bar inline wherever it’s mounted.
  59. #### `hideAfterFinish`
  60. Hides the progress bar after the upload has finished (`boolean`, default:
  61. `true`).