Attachment
File / image chip
A file in a conversation or a form — its name, type, size, a preview, upload progress. For picking files, FileInput or Uploader.
Basic
PDFscript_ep03.pdf212 KB
ZIPupload.zipuploading…
MOVraw.mov
EXEbad.exeUpload failed
vue
<script setup lang="ts">
import { BlessAttachment } from "blessing-ui";
import { shots } from "./_data";
</script>
<template>
<div class="row">
<BlessAttachment name="script_ep03.pdf" description="212 KB" removable />
<BlessAttachment name="storyboard.png" description="1.4 MB" :src="shots[5].src" href="#" />
<BlessAttachment name="upload.zip" description="uploading…" state="uploading" :progress="62" />
<BlessAttachment name="raw.mov" state="uploading" size="sm" />
<BlessAttachment name="bad.exe" state="error" removable />
</div>
</template>- With
hrefthe name is a link that covers the whole card; the remove button and#actionssit above it, so each stays its own control. Remove says which file; when you take the attachment away on@remove, move focus to its neighbour, as with Chip. stateshowsuploading(withprogress, or a spinner) anderror.
Usage
ts
import { BlessAttachment } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
name* | string | — | |
description | string | — | size / type line |
src | string | — | image preview |
href | string | — | renders <a> when set |
state | "idle" | "uploading" | "error" | "idle" | |
progress | number | — | 0–100 while uploading; omit for indeterminate |
size | "md" | "sm" | "md" | |
removable | boolean | — | |
removeLabel | string | "Remove" |
Events
| Name | Payload | Description |
|---|---|---|
remove | [] |
Slots
| Name | Scope | Description |
|---|---|---|
media | — | |
description | — | |
actions | — |