FleetbaseFleetbase

File

<File> renders a file card with preview (image thumbnail or icon), filename, and an optional actions dropdown. Pair with <FileIcon> for inline icons.

<File>

<File> renders a card-style preview of a Fleetbase file record. It shows the image thumbnail (for images) or a file-type icon (for everything else), the truncated filename, and an optional actions dropdown with delete/download/preview entries.

For a smaller inline icon, use <FileIcon>.

Basic Usage

{{#each this.driver.documents as |doc|}}
  <File
    @file={{doc}}
    @onDownload={{this.downloadDoc}}
    @onPreview={{this.previewDoc}}
    @onDelete={{this.deleteDoc}}
  />
{{/each}}

Arguments

Core

ArgumentTypeDescription
@filemodelThe Fleetbase file record (must have original_filename and url)

Actions

The actions dropdown renders only when at least one action callback is provided. Each callback receives the file:

ArgumentSignatureDescription
@onDelete(file)Show the Delete action
@onDownload(file)Show the Download action
@onPreview(file)Show the Preview action
ArgumentTypeDefaultDescription
@dropdownIconstringellipsis-vIcon for the actions trigger
@dropdownButtonIconPrefixstringFontAwesome prefix
@dropdownButtonTextstringOptional text on the trigger
@dropdownButtonRenderInPlacebooleantrueRender in DOM order
@dropdownButtonWrapperClassstringClass on the trigger wrapper
@dropdownButtonTriggerClassstringClass on the trigger itself
@dropdownButtonCalculatePositionfunctionCustom position calculator
@registerAPIfunctionCapture the dropdown's API
@onInsertfunctionCalled when the dropdown is inserted

Any additional ...attributes are forwarded to the outer card.

See Also

  • <FileIcon> — small inline file-type icon
  • <UploadButton> — trigger button for file uploads
  • <FileUpload> — file picker component

Source

File | Fleetbase