Corpora UI

Attachment

A compact attachment chip with a hover preview, or expanded content for documents, images, media, corpus text selections, quoted replies, @-handles and URL cards.

Preview

Use the controls to explore the component's props.

The default variant opens a preview on hover or keyboard focus for every attachment type. Use it in the composer and in sent messages; sent chips omit the remove button. The preview variant displays expanded content directly, without another hover preview. Both use the shared rounded-lg radius.

Pass the original file to let the component detect its type and create a local preview. Images display their content; videos show a frame and playback controls; audio has a player; text documents show an excerpt. PDFs use the browser's document viewer in the hover card. Unsupported formats show their file information. No file is uploaded automatically.

For uploaded files, supply src. You can also supply a thumbnail, previewText, or custom preview for a document or link whose content needs a server-generated preview. Object URLs are released when the attachment unmounts or its file changes.

Props

PropTypeDefaultDescription
kind (required)"document" | "image" | "media" | "text-selection" | "chat-reply" | "username-handle" | "url-link"—Which attachment; picks the leading icon and the preview layout.
variant"default" | "preview""default"Compact chip with hover/focus preview, or expanded content without a hover preview.
title / metaReactNode—Primary and secondary chip lines.
onRemove / removable() => void / boolean—The chip's ✕. Hidden when no handler is passed or removable is false.
file / srcFile / string—Original local file or uploaded content URL. Local files are classified automatically.
thumbnail / previewText / previewstring / string / ReactNode—Supplied thumbnail, document excerpt, or custom hover content.
mimeTypestringFile MIME typeContent type for a URL, e.g. application/pdf for a document preview.
kind propssrc, poster, duration, audio, onPlay, quote, author, time, body, initials, domain, description, favicon, href, onAction—Accepted per kind; the union type rejects props that don't belong to the chosen kind.

Example

Iliad · Book 1

Annotation notes
¶12 — Compare the paragraph boundary with the source edition.
¶17 — Check the speaker attribution and lemma links.
Iliad annotations.pdfPDF · 2.4 MB · 12 pages
Chat attachments.png
0:42
0:42 · voice-note.m4a
Iliad · Book 1, §12“…the will of Zeus was accomplished, from the time when first they parted in strife, Atreus’ son and godlike Achilles.”
Recipient10 min agoCan you check whether ¶12 keeps the RC003 boundary? The walker looks like it split it.
ED@emmanuel
sketch.comExegia UI — Chat UI canvasChat UI atoms, components and blocks for the Corpora assistant panel.
import { Attachment, Bubble } from "@exegia/corpora-ui"

<Attachment kind="document" title="Iliad annotations.pdf" meta="PDF · 2.4 MB" onRemove={remove} />
<Attachment kind="url-link" variant="preview" title="Exegia UI" domain="sketch.com" description="…" href="https://sketch.com" />

// Preserve file and kind-specific props when moving a tray item into the thread.
<Bubble variant="sender">
  <Bubble.Message unstyled>
    <Attachment {...attachment} variant="default" removable={false} />
  </Bubble.Message>
</Bubble>

Last updated on

On this page