MessageAttachment

Message-row attachment cards, media galleries, and pending/failed states composed as attachment children.

Preview#

AP
App Plannergpt-4.13:04 PM
Here is the source parity pass for #222. Mention chip, channel link, task link, and markdown are rendered by the caller.
This video may use a codec this browser cannot preview.
migration.diff2 files · 5 hunks+42-718 KB
screening.html44 KB
message-preview.wav4 KB
release-notes.md61 KB
metrics.csv24 rows · 6 columns1 KB
archive.zip12 KB
#2226 replies3 new

The card owns the shared title, summary, and two-sided metadata structure. Comment and diff content are alternative children of the same summary slot.

import {
  MessageAttachmentAction,
  MessageAttachmentCard,
  MessageAttachmentCommentSummary,
  MessageAttachmentDiffAddition,
  MessageAttachmentDiffDeletion,
  MessageAttachmentDiffSummary,
  MessageAttachmentGroup,
  MessageAttachmentMeta,
  MessageAttachmentMetaEnd,
  MessageAttachmentMetaStart,
  MessageAttachmentSummary,
  MessageAttachmentTitle,
  MessageItemAttachments,
} from "raft-ui";

<MessageItemAttachments>
  <MessageAttachmentGroup>
    <MessageAttachmentCard>
      <MessageAttachmentTitle />
      <MessageAttachmentSummary render={<MessageAttachmentCommentSummary />} />
      <MessageAttachmentMeta>
        <MessageAttachmentMetaStart />
        <MessageAttachmentMetaEnd>
          <MessageAttachmentAction />
        </MessageAttachmentMetaEnd>
      </MessageAttachmentMeta>
    </MessageAttachmentCard>
  </MessageAttachmentGroup>
</MessageItemAttachments>

<MessageAttachmentSummary render={<MessageAttachmentDiffSummary />}>
  <MessageAttachmentDiffAddition />
  <MessageAttachmentDiffDeletion />
</MessageAttachmentSummary>

Resolved media, loading fallback, and failure fallback are separate compositions.

import {
  MessageVideoPreview,
  MessageVideoPreviewAction,
  MessageVideoPreviewFailureAction,
  MessageVideoPreviewFailureContent,
  MessageVideoPreviewFailureIcon,
  MessageVideoPreviewFailureTitle,
  MessageVideoPreviewFallback,
  MessageVideoPreviewMedia,
  Spinner,
} from "raft-ui";

<MessageVideoPreview>
  <MessageVideoPreviewMedia />
  <MessageVideoPreviewAction />
</MessageVideoPreview>

<MessageVideoPreview aria-busy>
  <MessageVideoPreviewFallback>
    <Spinner />
  </MessageVideoPreviewFallback>
</MessageVideoPreview>

<MessageVideoPreview>
  <MessageVideoPreviewFallback>
    <MessageVideoPreviewFailureContent>
      <MessageVideoPreviewFailureIcon />
      <MessageVideoPreviewFailureTitle />
      <MessageVideoPreviewFailureAction />
    </MessageVideoPreviewFailureContent>
  </MessageVideoPreviewFallback>
</MessageVideoPreview>

Downloadable file#

Put attachment-specific diff content inside the shared summary slot. Keep file size and the caller-owned download action on opposite sides of the metadata row.

migration.diff2 files · 5 hunks+42-718 KB

Previewable file#

Keep preview state in the consumer; replace the Eye with the shared Spinner inside MessageAttachmentMetaEnd while the preview opens.

screening.html44 KB

Document summaries#

Use the summary only when a document has compact status information, such as CSV row and column counts. Metadata stays reserved for the file size.

metrics.csv24 rows · 6 columns1 KB
release-notes.md1 KB
screening.html44 KB
architecture.pdf1.2 MB

Title icon#

Render an SVG directly beside the filename inside the title slot; the attachment UI does not need a file-type prop or an icon slot.File-type icons are available from Icônes.

architecture.pdf1.2 MB

Comments and pending#

Put comment content inside MessageAttachmentSummary. For pending state, place the shared Spinner in MessageAttachmentMetaEnd instead of introducing a card-level variant.

release-notes.md61 KB
metrics.csv1 KB

Inline video states#

Render real media, URL loading, and unavailable-codec fallback as separate video states. Preview and download workflows remain caller-owned.

This video may use a codec this browser cannot preview.

Media layouts#

Compose native grid rows in the consumer. MessageImageGalleryItem owns cell chrome; MessageImageGalleryMedia only provides the media container.

Consumer layout classes set cell geometry, while the media child chooses object-cover or object-contain.

API#WIP

PropTypeDefaultDescription
...propsMessageAttachmentGroupPropsHorizontal group of attachment cards inside MessageItemAttachments.
PropTypeDefaultDescription
...propsMessageAttachmentCardPropsAttachment card root.
PropTypeDefaultDescription
...propsMessageAttachmentTitlePropsFilename slot at the start of MessageAttachmentCard.
PropTypeDefaultDescription
...propsMessageAttachmentSummaryPropsShared summary row. Owns layout, icon sizing, placement, and typography; compose a semantic summary through render.
PropTypeDefaultDescription
...propsMessageAttachmentCommentSummaryPropsComment-summary semantics composed onto MessageAttachmentSummary. Owns only its compact gap and muted color.
PropTypeDefaultDescription
...propsMessageAttachmentDiffSummaryPropsDiff-summary semantics composed onto MessageAttachmentSummary. Owns only its internal gap.
PropTypeDefaultDescription
...propsMessageAttachmentDiffAdditionPropsSemantic positive-diff value inside MessageAttachmentDiffSummary.
PropTypeDefaultDescription
...propsMessageAttachmentDiffDeletionPropsSemantic negative-diff value inside MessageAttachmentDiffSummary.
PropTypeDefaultDescription
...propsMessageAttachmentMetaPropsTwo-sided metadata row inside MessageAttachmentCard.
PropTypeDefaultDescription
...propsMessageAttachmentMetaStartPropsStart-side metadata region, typically file size.
PropTypeDefaultDescription
...propsMessageAttachmentMetaEndPropsEnd-side metadata region for actions or a pending spinner.
PropTypeDefaultDescription
...propsMessageAttachmentActionPropsCaller-owned preview or download action inside MessageAttachmentMetaEnd.
PropTypeDefaultDescription
...propsMessageVideoPreviewPropsInline video attachment root.
PropTypeDefaultDescription
...propsMessageVideoPreviewMediaPropsNative video media element for a resolved URL.
PropTypeDefaultDescription
...propsMessageVideoPreviewFallbackPropsFallback region for consumer-owned URL loading or unavailable-media content. Render instead of MessageVideoPreviewMedia.
PropTypeDefaultDescription
...propsMessageVideoPreviewActionPropsTop-right caller-owned preview action inside MessageVideoPreview.
PropTypeDefaultDescription
...propsMessageVideoPreviewFailureContentPropsStructured unavailable-codec fallback content.
PropTypeDefaultDescription
...propsMessageVideoPreviewFailureIconPropsWarning-icon slot inside failure content.
PropTypeDefaultDescription
...propsMessageVideoPreviewFailureTitlePropsFailure copy slot inside failure content.
PropTypeDefaultDescription
...propsMessageVideoPreviewFailureActionPropsDownload button inside failure content; callers provide its icon, copy, and workflow.