For AI agents: the complete documentation index is available at https://a3s-lab.github.io/UI/v0.4.1/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/UI/v0.4.1/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/UI/v0.4.1/components/message-attachment.md.

消息附件

消息附件展示与单条消息关联的文件、图片、源码范围或 URL。上传和持久化由宿主应用负责。

实时预览
release-notes.mdMarkdown · 12 KB
workspace.png正在上传 · 72%

用法

<article class="message-attachment" data-state="complete">
  <figure aria-hidden="true">...</figure>
  <div data-attachment-identity><strong>release-notes.md</strong><span data-attachment-meta>Markdown · 12 KB</span></div>
  <button type="button" aria-label="移除 release-notes.md">...</button>
</article>

参数

API取值用途
data-stateready、uploading、complete、missing、error附件生命周期
data-attachment-identity必须名称、类型或源码范围
data-attachment-meta可选大小、上传进度或路径

状态与变体

上传失败后保留附件,以便重试或移除。源码范围不存在时应说明不可用文件和恢复方式。

无障碍

移除和重试按钮标签包含附件名。文件类型图标作为装饰并对辅助技术隐藏。