---
url: https://talkjs.com/docs/UI_Components/React_Native/Object_Types/Attachment
---

# Attachment

Ask a question Copy for LLM [View as Markdown](/docs/UI_Components/React_Native/Object_Types/Attachment.md)
An object with the URL and filesize (in bytes) of the given file.

Attachment dimensions (in px) are sometimes available for image and video attachments
and are used to set the size of the thumbnail before loading, to prevent content shift when loading media on slower connections.

## Example

```typescript
{
  url: "https://firebasestorage.googleapis.com/v0/b/glaring-fire-2362/o/user_files%2Ft8Serdim%2F22503512b64d4439847c4b3b2f5a9cf6%2Fwatch-this.gif?alt=media&token=4418bd87-f2f1-4bbf-89d3-71be1b5c2772",
  size: 3374800,
  dimensions: {
    height: 336,
    width: 498,
  }
}
```

## Properties

| Field | Type | Description |
| --- | --- | --- |
| **url** | `string` | The url to the uploaded file. |
| **size** | `number` | The size of the file in bytes. |
| **dimensions** *(optional)* | [`AttachmentDimensions`](#attachmentdimensions) | Extra metadata for image, video and audio files. |

## Type Definitions

### AttachmentDimensions

#### Properties

| Field | Type | Description |
| --- | --- | --- |
| **width** *(optional)* | `number` | The width of the image or video in pixels, if known. |
| **height** *(optional)* | `number` | The height of the image or video in pixels, if known. |
| **duration** *(optional)* | `number` | The duration of the video or audio in seconds, if known. |

## Used by

- [Message](/docs/UI_Components/React_Native/Object_Types/Message/#properties)
- [SentMessage](/docs/UI_Components/React_Native/Components/Chatbox/#sentmessage)