Skip to content

useAttachments

View as Markdown
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).

object

Name Type Defined in
items DraftAttachment[] react/src/hooks.ts:206
ready boolean react/src/hooks.ts:210
rejected AttachmentRejection[] 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