# useAttachments

<!-- https://uncage.vercel.app/docs/api/react/functions/useattachments/ -->

```ts
function useAttachments(): object;
```

Defined in: react/src/hooks.ts:205

Composer attachments. `add` validates client-side (type, runtime capability, size, at most
`ATTACHMENT_LIMITS.maxPerMessage`) and uploads to the open session; in a draft, files queue and
upload right after `commitDraft`. `ready` is false while an upload is in flight or has failed
(queued draft files count as ready: `sendPrompt` waits for their uploads). In React Native, pass
file references `{ uri, name, type, size? }` (see `AttachmentFile`).

## Returns

`object`

| Name | Type | Defined in |
| ------ | ------ | ------ |
| `items` | [`DraftAttachment`](https://uncage.vercel.app/docs/api/react/interfaces/draftattachment.md)[] | react/src/hooks.ts:206 |
| `ready` | `boolean` | react/src/hooks.ts:210 |
| `rejected` | [`AttachmentRejection`](https://uncage.vercel.app/docs/api/react/interfaces/attachmentrejection.md)[] | react/src/hooks.ts:211 |
| `add()` | (`files`) => `void` | react/src/hooks.ts:207 |
| `clear()` | () => `void` | react/src/hooks.ts:209 |
| `remove()` | (`localId`) => `void` | react/src/hooks.ts:208 |
