Attachment
A file in a composer, upload list or chat: thumbnail or type icon, name, size, upload progress, error, remove and download.
API
For AI agents: this API as Markdown, or every component in llms-full.txt.
<ray-attachment>
Assign a File to `file` to fill name, size, type and an image thumbnail. Removing it (× button) fires a cancelable ray-remove and then removes the element.
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
name | name reflects | string | File name (ellipsized; full name in the tooltip). | |
size | size | number | Size in bytes, shown as "12 KB", "3.4 MB". | |
type | type reflects | string | MIME type: picks the icon (image or file) and, with the name, the extension badge. | |
src | src | string | Thumbnail URL for images (falls back to the icon if it fails to load). | |
href | href reflects | string | Makes the name a download link. | |
progress | progress | number | Upload progress 0–100: a thin bar and "Uploading… 45%". Unset: done. | |
status | status reflects | uploading | done | error | Explicit state. Default: "uploading" while progress is set, else "done". | |
error | error | string | Error text shown with status="error" (default "Upload failed"). | |
removable | removable reflects | boolean | Shows a remove (×) button. | |
removeLabel | remove-label | string | Remove {name} (text attachment.remove) | Accessible label of the remove button; {name} is replaced by the file name. |
variant | variant reflects | row | card | row | row: a compact chip; card: the thumbnail on top. |
disabled | disabled reflects | boolean | Dimmed, not removable, the name is not a link. |
| Event | Description |
|---|---|
ray-remove | The remove button was pressed; cancelable (preventDefault keeps the element). |
| Part | Description |
|---|---|
item | The box. |
thumbnail | The thumbnail or icon box. |
badge | The extension badge (PDF, PNG…). |
name | The file name (a link with href). |
meta | Size, upload state or error. |
progress | The upload progress bar. |
remove | The remove button. |
<ray-attachments>
A wrapping row of ray-attachment elements.
| Slot | Description |
|---|---|
| (default) | ray-attachment elements. |
Texts
What it writes itself, in English; setStrings() translates them (Getting started: Languages).
| Key | English |
|---|---|
attachment.remove | Remove {name} |
attachment.uploading | Uploading… |
attachment.uploading-percent | Uploading… {percent}% |
attachment.progress | Uploading {name} |
attachment.failed | Upload failed |