PhoenixKitWeb.Components.Core.FileUpload (phoenix_kit v1.6.15)

View Source

Reusable file upload component for PhoenixKit.

Provides a simple file upload button with auto-upload functionality. Files are uploaded immediately upon selection without requiring a submit button.

Usage

<.file_upload
  upload={@uploads.media_files}
  label="Upload Media"
/>

Attributes

  • upload (required) - LiveView upload config from allow_upload/3
  • label (optional) - Button label (default: "Upload Files")
  • icon (optional) - Icon name (default: "hero-cloud-arrow-up")
  • accept_description (optional) - Text describing accepted file types
  • max_size_description (optional) - Text describing max file size

Summary

Functions

file_upload(assigns)

Attributes

  • upload (:any) (required)
  • label (:string) - Defaults to "Upload Files".
  • icon (:string) - Defaults to "hero-cloud-arrow-up".
  • accept_description (:string) - Defaults to nil.
  • max_size_description (:string) - Defaults to nil.
  • uploaded_file_ids (:list) - List of file IDs from last upload (for external use). Defaults to nil.
  • variant (:string) - Display variant - 'full' for drag-drop zone, 'button' for simple button only. Defaults to "full".