PhiaUi.Components.UploadProgress (phia_ui v0.1.17)

Copy Markdown View Source

Standalone upload progress component with status states.

Provides upload_progress/1 — a self-contained progress row that shows the upload status of a single file. Useful outside of Phoenix LiveView's native upload system, e.g. when tracking progress from a custom JS uploader or when displaying server-side upload task status.

Status states

StatusVisual
:pendingPulsing grey bar — queued, not yet started
:uploadingAnimated blue bar with progress %
:doneSolid green bar at 100% with checkmark
:errorRed bar with error message + retry button
:canceledStrikethrough name, greyed out

Basic usage

<.upload_progress
  filename="invoice.pdf"
  status={:uploading}
  progress={42}
/>

<.upload_progress
  filename="report.xlsx"
  status={:done}
  progress={100}
/>

<.upload_progress
  filename="photo.png"
  status={:error}
  error_message="File too large — maximum 10 MB"
  on_retry="retry_upload"
  on_cancel="cancel_upload"
/>

Summary

Functions

Renders a single-file upload progress row.

Functions

upload_progress(assigns)

Renders a single-file upload progress row.

Examples

<.upload_progress filename="cv.pdf" status={:uploading} progress={67} on_cancel="cancel" />

<.upload_progress filename="photo.jpg" status={:done} progress={100} />

<.upload_progress filename="data.csv" status={:error} error_message="Network error" on_retry="retry" />

Attributes

  • filename (:string) (required) - Name of the file being uploaded.
  • status (:atom) - Current upload status atom. Defaults to :pending. Must be one of :pending, :uploading, :done, :error, or :canceled.
  • progress (:integer) - Upload progress percentage (0–100). Only meaningful for :uploading and :done. Defaults to 0.
  • error_message (:string) - Error description shown in the :error state. Defaults to nil.
  • on_cancel (:string) - LiveView event name for the cancel button (shown in :pending and :uploading states). Defaults to nil.
  • on_retry (:string) - LiveView event name for the retry button (shown in :error state). Defaults to nil.
  • class (:string) - Additional CSS classes applied to the outer wrapper. Defaults to nil.