Skip to main content

Module attachment

Module attachment 

Source
Expand description

Attachment previews: the files a person adds to a prompt and the files a message carries.

One Attachment value describes a file by stable ID, name, kind, size, optional thumbnail, and upload lifecycle. AttachmentPreview renders it as a tile (thumbnail or kind glyph, name, metadata, state) and AttachmentStrip lays tiles out in a wrapping row that ripples in. The same strip serves both sides of a conversation: removable and compact inside the composer, read-only and openable inside a message.

Applications own the bytes, the upload, and what “open” means; the components only report AttachmentEvents keyed by attachment ID.

Structs§

Attachment
One file with stable identity, presentation metadata, and upload state.
AttachmentPreview
One attachment tile.
AttachmentStrip
A wrapping row of attachment tiles that ripple into place.

Enums§

AttachmentEvent
An interaction emitted by attachment previews.
AttachmentKind
The family a file belongs to; drives the fallback glyph and the kind label.

Functions§

format_bytes
Formats a byte count the way file managers do (820 B, 12 KB, 1.4 MB).