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.
Pending local attachments can render upload progress in MessageList. Image and video attachments use AttachmentUploadIndicator through Gallery and VideoThumbnail; file and audio attachments render the same upload state in their preview metadata.
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
AttachmentActionsfor supported actions instead of custom tap logic. - Ensure URL previews and media rendering are consistent with your app theme.
Props
| Prop | Description | Type |
|---|---|---|
attachment | Attachment object to render. Typically an item from message.attachments (for example, message.attachments[0]). | object |
UI Component Props
| Prop | Description | Type |
|---|---|---|
AttachmentActions | Renders additional attachment actions (for example, Giphy send/shuffle/cancel). Defaults to AttachmentActions. | ComponentType |
AttachmentUploadIndicator | Renders pending upload progress for local image, video, file, and audio attachments. Defaults to AttachmentUploadIndicator. | ComponentType |
CircularProgressIndicator | Renders the circular ring used by upload indicators. Defaults to CircularProgressIndicator. | ComponentType |
FileAttachment | Renders file attachments in MessageList. Defaults to FileAttachment. | ComponentType |
Gallery | Renders image attachments in MessageList. Defaults to Gallery. | ComponentType |
Giphy | Renders Giphy attachments in MessageList. Defaults to Giphy. | ComponentType |
MediaUploadProgressOverlay | Renders the full-cover upload overlay for image and video thumbnails. Defaults to MediaUploadProgressOverlay. | ComponentType |
UrlPreview | Renders URL previews in MessageList. Defaults to UrlPreview. | ComponentType |
URLPreviewCompact | Renders compact URL previews in MessageList. Defaults to URLPreviewCompact. | ComponentType |
urlPreviewType | Type of URL preview to render. Defaults to 'full'. | 'full' | 'compact' |