2.10.0
中文
Skip to content

FileCard ​

Display files in the form of cards.

When to use ​

  • Used to display files during conversation or input.

Examples ​

Basic usage ​

excel-has-long-long-long-name.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
markdown-file.md
1 KB
java-file.java
1 KB
javascript-file.js
1 KB
python-file.py
1 KB
excel-file.xlsx
1 KB
Basic usage

Different file types pick matching icons and colors.

Card size ​

pdf-file.pdf
1 KB
pdf-file.pdf
1 KB
Card size

Set the card size through the size property.

Image files ​

image-file.png
Preview
image-file.png
Preview
image-file.png
1 KB
Image files

Image type files will automatically show image previews. You can force display as a file card using type="file".

Image loading ​

0%
Image placeholder
0%
Image placeholder
Image loading

Show a loading animation while images load.

Audio and video ​

audio-file.mp3
1 KB
video-file.mp4
1 KB
Audio and video

Audio and video type files support inline playback, and can also be displayed as file cards using type="file".

Overlay mask ​

txt-file.txt
1 KB
Overlay mask

Add overlay content through the mask property.

Custom icon ​

txt-file.txt
1 KB
android-file.apk
1 KB
Custom icon

Customize icons through the icon property, supporting preset icon names or custom VNode.

File list ​

excel-file.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
excel-file.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
image-file.png
Preview
File list

Display file lists using FileCard.List, supporting deletion and image preview.

Overflow style ​

image-file-0.png
Preview
image-file-1.png
Preview
image-file-2.png
Preview
image-file-3.png
Preview
image-file-4.png
Preview
image-file-5.png
Preview
image-file-6.png
Preview
image-file-7.png
Preview
image-file-8.png
Preview
image-file-9.png
Preview
image-file-10.png
Preview
excel-file.xlsx
1 KB
word-file.docx
1 KB
pdf-file.pdf
1 KB
ppt-file.pptx
1 KB
zip-file.zip
1 KB
txt-file.txt
1 KB
Overflow style

Control the display style when the list overflows through the overflow property.

API ​

FileCardProps ​

PropDescriptionTypeDefaultVersion
nameFile Namestring--
byteFile size (bytes)number--
sizeCard Size'small' | 'default''default'-
descriptionDocument DescriptionVNode | string--
loadingIs it in loaded modebooleanfalse-
typeFile Type'file' | 'image' | 'audio' | 'video' | string--
srcImage or File Addressstring--
maskMask ContentVNode | string--
iconCustom iconVNodePresetIcons-
imagePropsImage properties, same as ant-design-vue Image propertiesImageProps--
videoPropsVideo Attribute ConfigurationRecord<string, any>--
audioPropsAudio Attribute ConfigurationRecord<string, any>--
spinPropsLoading Properties[SpinProps] (https://www.antdv.com/components/spin-cn#api) & { showText?: boolean; icon?: VNode }--
onClickClick event callback() => void--

PresetIcons ​

Preset icon types, supporting the following values:

typescript
type PresetIcons =
  | 'default'    // 默认文件图标
  | 'excel'      // Excel 文件图标
  | 'image'      // 图片文件图标
  | 'markdown'   // Markdown 文件图标
  | 'pdf'        // PDF 文件图标
  | 'ppt'        // PowerPoint 文件图标
  | 'word'       // Word 文件图标
  | 'zip'        // 压缩文件图标
  | 'video'      // 视频文件图标
  | 'audio'      // 音频文件图标
  | 'java'       // Java 文件图标
  | 'javascript' // JavaScript 文件图标
  | 'python';    // Python 文件图标

FileCard.List ​

File list component, used to display multiple file cards.

PropDescriptionTypeDefaultVersion
itemsFile list data. Each item is FileCardProps, and key can be used as a stable identifier; defaults to name-index if missing(FileCardProps & { key?: stringnumber })[]-
sizeCard Size'small' | 'default''default'-
removableWhether it can be deletedboolean((item: FileCardProps) => boolean)false
onRemoveRemove event callback(item: FileCardProps) => void--
extensionExtended contentVNode--
overflowOverflow display method'scrollX''scrollY''wrap'

Semantic DOM ​

pdf-file.pdf
1 KB
  • root
    根节点
  • file
    文件
  • icon
    图标
  • name
    名称
  • description
    描述
excel-file.xlsx
1 KB
excel-file.xlsx
1 KB
excel-file.xlsx
1 KB
  • root
    根节点
  • card
    卡片
  • file
    文件
  • icon
    图标
  • name
    名称
  • description
    描述

Design Token ​

This component has no custom Component Token. Customize it through global Design Tokens.