Skip to content
Latestv1.0.63

AiFileCard ​

Display a file in card form. Supports document/image/audio/video types, multiple sizes, loading state, and mask.

When to use ​

Use when displaying a single file in conversation or input scenarios, e.g. attachment lists or file previews in message bubbles.

Basic usage ​

Provide required name; optional props include byte, size, type, src. Cards use uniform width and height; long filenames are truncated with ellipsis; hover to see full name.

Basic usage

Card size ​

Set size to small, default, or large.

Card size

Image file ​

When type="image" and src is set, the card shows an image preview.

Image file

Image loading ​

Use the loading prop to show a loading state; the image stays visible but blurred with a spinner overlay, then transitions to clear when loading completes. The example below uses buttons to toggle between loading and complete.

Image loading

Using mask ​

Use mask to show overlay text (e.g. "Encrypted") on the card.

Using mask

Preset icon types ​

Use the icon prop with preset icons. Supported types: default, pdf, excel, word, ppt, image, markdown, zip, video, audio, java, javascript, python, txt. You can also omit icon and rely on extension-based inference.

Preset icon types

Audio / Video ​

Aligns with Ant Design X FileCard: uses browser native <audio> / <video>; when src is provided, media is directly playable. For 3+ items, use traversal (v-for); the delete button removes the item. Without src, the preset icon placeholder is shown. Use audioProps / videoProps to extend native playback.

Audio / Video

File list ​

Multiple file cards can be used with AiAttachments for list layout, overflow behavior, and delete. See AiAttachments.

API ​

FileCard Props ​

PropertyDescriptionTypeDefault
nameFile name (required)string-
byteFile size in bytesnumber-
sizeCard size'small' | 'default' | 'large''default'
typeFile type'file' | 'image' | 'audio' | 'video' | string'file'
srcImage or file URLstring-
descriptionDescriptionstring-
loadingLoading statebooleanfalse
maskMask contentstring-
iconPreset iconPresetFileIcons'default'
imagePropsImage props (passed to img element)Record<string, unknown>{}
videoPropsVideo props (passed to video element)Record<string, unknown>{}
audioPropsAudio props (passed to audio element)Record<string, unknown>{}
themeOverridesTheme override variablesRecord<string, unknown>-

Slots ​

SlotDescription
defaultExtension content (e.g. delete button, progress bar when used with AiAttachments)

PresetFileIcons ​

Preset icon types:

  • default - Default file icon
  • excel - Excel file icon
  • image - Image file icon
  • markdown - Markdown file icon
  • pdf - PDF file icon
  • ppt - PowerPoint file icon
  • word - Word file icon
  • zip - Archive file icon
  • video - Video file icon
  • audio - Audio file icon
  • java - Java file icon
  • javascript - JavaScript file icon
  • python - Python file icon
  • txt - Text file icon

FileCardListItem ​

List item interface extends FileCardProps with additional properties:

PropertyDescriptionType
uidUnique identifierstring | number
urlFile URLstring
thumbUrlThumbnail URLstring

Events ​

EventDescription
clickFired when card is clicked (when not loading); for image type, clicking opens the preview

Released under the MIT License.