Attachment

Renders message attachments inside MessageList. This is the default component for the Attachment prop.

It selects the correct renderer by attachment type (card, Giphy, file, etc.). For customization, use type-specific props like Giphy, Gallery, UrlPreview, or FileAttachment. See Attachment Customization for details.

Best Practices

  • Prefer type-specific overrides (Gallery, FileAttachment) over replacing the whole Attachment component.
  • Handle unknown or custom attachment types gracefully.
  • Keep attachment rendering lightweight to avoid list jank.
  • Use AttachmentActions for supported actions instead of custom tap logic.
  • Ensure URL previews and media rendering are consistent with your app theme.

Props

PropDescriptionType
attachmentAttachment object to render. Typically an item from message.attachments (for example, message.attachments[0]).object

UI Component Props

PropDescriptionType
AttachmentActionsRenders additional attachment actions (for example, Giphy send/shuffle/cancel). Defaults to AttachmentActions.ComponentType
FileAttachmentRenders file attachments in MessageList. Defaults to FileAttachment.ComponentType
GalleryRenders image attachments in MessageList. Defaults to Gallery.ComponentType
GiphyRenders Giphy attachments in MessageList. Defaults to Giphy.ComponentType
UrlPreviewRenders URL previews in MessageList. Defaults to UrlPreview.ComponentType
URLPreviewCompactRenders compact URL previews in MessageList. Defaults to URLPreviewCompact.ComponentType
urlPreviewTypeType of URL preview to render. Defaults to 'full'.'full' | 'compact'