Ask Rift AI
Theme: Smoke
Layout: Contained
Background: Field
Search or ask anythingAsk Rift AI
Theme: Smoke
Layout: Contained
Background: Field
Colour mode: System

Attachment tile

One file, drawn as a square

A picture fills the tile. A well-known document format wears a coloured mark, and every other file wears its extension as a neutral badge. Under the mark sit the name, cut in the middle so the extension survives, and one line for the size or the state. The same tile serves a composer’s queue and a sent message.

Every kind, every state

Each row is a kind of file and each column is a state. The mark, the spinner and the state icons all fill the same square at the same seat, so a file changing state never moves anything.

KindReadyUploadingFailedUnavailable
Image
Screenshot 5 PM.png
Screenshot 5 PM.pngUploading…
Screenshot 5 PM.pngUpload failed
Screenshot 5 PM.pngUnavailable
PDF, first page
Meeting notes.pdf
Meeting notes.pdfUploading…
Meeting notes.pdfUpload failed
Meeting notes.pdfUnavailable
PDF
demo_schedule_sep28_oct4.pdf1.2 MB
demo_schedule_sep28_oct4.pdfUploading…
demo_schedule_sep28_oct4.pdfUpload failed
demo_schedule_sep28_oct4.pdfUnavailable
Spreadsheet
Q4 roadmap.xlsx88 KB
Q4 roadmap.xlsxUploading…
Q4 roadmap.xlsxUpload failed
Q4 roadmap.xlsxUnavailable
CSV
hours_export.csv12 KB
hours_export.csvUploading…
hours_export.csvUpload failed
hours_export.csvUnavailable
Document
Weekly team notes.docx54 KB
Weekly team notes.docxUploading…
Weekly team notes.docxUpload failed
Weekly team notes.docxUnavailable
Slides
Q4 kickoff deck.pptx5.6 MB
Q4 kickoff deck.pptxUploading…
Q4 kickoff deck.pptxUpload failed
Q4 kickoff deck.pptxUnavailable
Pasted text
Pasted textPaid time off policy (2026) Full-time employees accrue 1.5 days of PTO per month, credited on the first working day.
Pasted textUploading…
Pasted textPaste failed
Pasted textUnavailable
Any other type
Q4 plan.key3.4 MB
Q4 plan.keyUploading…
Q4 plan.keyUpload failed
Q4 plan.keyUnavailable

Well-known formats

PDFs, spreadsheets, documents and presentations each keep the colour they are known by, in every theme. The lettering under the mark is drawn in a text colour, so it stays readable whatever the format colour is.

Contract.pdf1.2 MB
Q4 roadmap.xlsx88 KB
Weekly notes.docx54 KB
Kickoff deck.pptx5.6 MB

Everything else

Any other file wears its extension as a neutral badge. Colour stays a signal for the formats a reader recognises at a glance.

voice-note.mp32.1 MB
export.md4 KB
assets.zip18.4 MB
Q4 plan.key3.4 MB

Previews

A picture fills the tile. A document can do the same with a first page the host has rendered, and keeps its format as a badge over the corner. The library draws no documents itself: pass the image in.

Hills at dusk.png
Meeting notes.pdf
Pasted textPaid time off policy (2026) Full-time employees accrue 1.5 days of PTO per month, credited on the first working day.

Removable and clickable

Click and remove are separate controls, so opening a file never fights with detaching it. The remove button appears on hover and on focus, and stays visible on a file that failed. Try removing these.

Compact

Compact shrinks the square and drops the second line of a ready file, for a dense thread.

Contract.pdf
Hills.png
Q4 plan.key
Q4 roadmap.xlsxUploading…

Alternatives

  • Use File row instead when the file is one of a list of documents, read as rows.

Props

Read from the same JSDoc that ships in the package's types. A required prop is marked with an asterisk.

AttachmentTile props
PropTypeDefaultDescription
name*
string
File name, extension included. Truncates in the middle so the extension stays visible.
kind
FileKind
'generic'
What kind of file it is, which picks the type mark: a coloured lettered glyph for the well-known formats, a neutral extension badge for the rest. Derive it with `getFileKind`.
typeLabel
string
Short uppercase label on the type mark. Defaults from the kind and the extension.
status
AttachmentStatus
'ready'
Where the file is in its life. Anything but `ready` shows the name with a status line.
progress
number
Upload progress, 0 to 100, reported to assistive technology while `uploading`.
previewSrc
string
Image that fills the tile while `ready`: an object URL for a picture, or a first page the host rendered for a document. A non-image kind keeps its type mark over the corner.
previewAlt
string
Alt text for the preview. Defaults to the file name.
previewMark
boolean
Whether the type mark sits over the corner of a preview. Defaults to on for a document's first page, which still has to say what format it is, and off for a picture, which is its own description. A sent message turns it on for pictures too.
excerpt
string
First lines of a pasted block, drawn as a faded excerpt filling the tile while `ready`.
meta
string
Secondary line under the name while `ready`, e.g. "1.2 MB". Callers keep their own formatting.
error
string
Why the file failed. Replaces `errorLabel` on the status line.
size
"default" | "compact"
'default'
Tile size. Compact shrinks the square and drops the secondary line of a ready file. Unrelated to any native `size` attribute: the root is a div.
onClick
MouseEventHandler<HTMLButtonElement>
Click handler. Its presence makes the tile body a button.
onRemove
(() => void)
Remove handler. Its presence renders the corner remove button.
uploadingLabel
string
'Uploading…'
Status line while `uploading`.
errorLabel
string
'Upload failed'
Status line while `error`, when no `error` message is given.
unavailableLabel
string
'Unavailable'
Status line while `unavailable`.
removeLabel
string
Accessible label for the remove button. Defaults to "Remove" and the file name.
progressLabel
((name: string) => string)
(fileName: string) => `Uploading ${fileName}`
Accessible name of the upload progress spinner while `uploading`, given the file name. Defaults to "Uploading" followed by the name.
className
string
''
Additional CSS classes

Keys

Nothing here takes focus, so there are no keys. A test holds that.

tsx
// From the npm package
import { AttachmentTile } from 'rift-ds/components/AttachmentTile/AttachmentTile';

// Or as source you own, via the shadcn CLI
npx shadcn@latest add https://rift-ds.com/r/attachment-tile.json

3.1 kB gzipped, with everything it imports. Peer dependencies are not counted.

For agents: the props, their allowed values and defaults, and the tested keys, as markdown or as a JSON schema.