Skip to content

React Native components (@agentimhq/react-native-ui) API

Generated from the source and its doc comments (sdk/react-native-ui/src/components.tsx, sdk/react-native-ui/src/files.tsx).

Terminal window
npm install @agentimhq/react-native-ui @agentimhq/client-react-native
function AgentIM(

The client, the texts, the replaceable parts, who “I” am, how dates are shown and the theme (scheme: light, dark or the system’s; colors overrides any token).

function AIBadge()

The AI mark (EU AI Act art. 50): drawn next to every agent’s name and message, also under a replaced Message component.

function ConnectionBanner()

A line saying what the connection is doing (offline, reconnecting, waiting for network); nothing while connected.

function ConversationList({ selected, onSelect, search = true }: { selected?: string; onSelect(convId: string): void; search?: boolean })

The conversations, newest first, with a search field that filters by title and last message.

function DefaultSteps({ steps, strings }: StepsProps)

The default list of an agent’s steps (docs/en/design/chat-components.md).

function DefaultInboxDetail({ item: i, inbox, strings, when: w, outcome, onOpen }: InboxDetailProps)

The default details of an inbox item, with its actions.

function Inbox({ types, extraItems = [], renderItem, onOpen }: { types?: string[]; extraItems?: InboxItem[]; renderItem?(p: InboxDetailProps): ReactNode; onOpen?(convId: string): void })

The approval inbox (docs/en/design/chat-components.md): tabs, search, the list, and one item’s details with its actions (on a phone, one after the other).

function InboxBadge()

How many items wait in the inbox.

function ConversationSteps({ convId }: { convId: string })

Steps an agent reports without tying them to a message (docs/en/design/chat-components.md).

function MessageList({ convId, notices = [], onOpenThread }: { convId: string; notices?: Notice<ReactNode>[]; onOpenThread?(threadId: string): void })

The messages in an inverted list (newest at the bottom, scroll up for older ones; Stream Chat does the same), in runs per sender with day separators, notices and “New messages”; a button brings you back down.

function TypingIndicator({ convId, names }: { convId: string; names?: (ids: string[]) => string[] })

Who is typing, by name (from the members).

function Composer({ convId, onAttach }: { convId: string; onAttach?: () => Promise<string[] | undefined | null> })

onAttach: the app’s own picker (expo-document-picker, react-native-image-picker, …) returns the paths to send; without it there is no attach button.

function MemberList({ convId }: { convId: string })

The conversation’s members; agents carry the AI mark.

function HandoffNotice({ convId }: { convId: string })

Says when an agent hands the conversation to a person, and when it is back.

function Chat({ convId, title, subtitle, notices, onAttach }: { convId: string; title?: string; subtitle?: string; notices?: Notice<ReactNode>[]; onAttach?: () => Promise<string[] | undefined | null> })

A whole chat screen: header, status, messages, typing, composer. Wrap it in the app’s keyboard handling.

function FileIcon({ type, size = 40 }: { type: string; size?: number })

A page with a folded corner in the type’s colour, its label in white.

function ImageViewer({ convId, message: m, thumb, strings, onClose }: { convId: string; message: Message; thumb?: string; strings: Strings; onClose(): void })

The full-screen viewer of an image: the enlarged thumbnail, View original, Download, close (Android back closes it too).

function ImageMessage({ convId, message: m, strings, mine }: { convId: string; message: Message; strings: Strings; mine: boolean })

An image message: the thumbnail at its proportions (at most 240 × 240) with its caption and upload progress; pressing opens the viewer.

function FileMessage({ convId, message: m, strings, mine }: { convId: string; message: Message; strings: Strings; mine: boolean })

A file message: a card with the type’s icon, the name, the size and upload progress; pressing opens the file.

interface MessageProps

What a message component gets: replace Message in components to draw messages your way.

message: Message

The message to show.

convId: string

The conversation (to read the message’s file).

mine: boolean

Whether I sent it (shown on the right).

first: boolean

Whether it starts a run of messages from the same sender (shows the name and avatar).

last: boolean

Whether it ends a run of messages from the same sender (shows the time).

time?: string

The formatted time to show, when it shows one.

strings: Strings

The interface texts in the current language.

onRetry(): void

Sends a failed message again.

onDiscard(): void

Drops a failed message.

onFeedback(rating: 'up' | 'down'): void

Rates an agent’s message.

onRespond(blockId: string, r: { action?: string; values?: Record<string, unknown> }): void

Answers a card block: a button action or form values.

onEdit?(text: string): void

Edits my message (when it can still be edited).

onRecall?(): void

Recalls my message for everyone.

onStop?(): void

Stops an agent’s streaming reply.

onReact?(key: string, on: boolean): void

Adds (on) or removes my reaction (docs/en/design/messaging.md).

onOpenThread?(): void

Set when the app shows threads: opens this message’s thread.

interface ConversationItemProps

What a conversation list row gets: replace ConversationItem in components to draw rows your way.

conversation: any

The conversation (title, last message, unread count, members…).

selected: boolean

Whether it is the open conversation.

onSelect(): void

Opens it.

strings: Strings

The interface texts in the current language.

time?: string

The formatted time of the last message.

me?: string

My user id (for “You: …” previews and direct-conversation titles).

interface Components

The parts you can replace, passed as components to AgentIM.

Message: ComponentType<MessageProps>

Draws one message.

ConversationItem: ComponentType<ConversationItemProps>

Draws one conversation list row.

Avatar: ComponentType<{ id?: string; name?: string; kind?: string; size?: number }>

Draws an avatar from the id, name and kind (human or agent).

Empty: ComponentType<{ text: string; hint?: string }>

Draws an empty state (no conversations, no messages).

Steps?: ComponentType<StepsProps>

Draws an agent’s steps next to its reply (docs/en/design/chat-components.md).

cardBlocks?: Record<string, ComponentType<CardBlockProps>>

Your own card blocks, by type (x-…, docs/en/design/chat-components.md).

formFields?: Record<string, ComponentType<FormFieldProps>>

Your own form fields, by type: x-…, or a built-in one drawn your way (a native date picker for date).

interface CardBlockProps

What your own card block gets.

block: any

The block as sent (type, id, data, fallback).

done: boolean

Whether it can’t be answered (any more) by this person.

respond(r: { action?: string; values?: Record<string, unknown> }): void

Answers it: an action or values (blocks with an id only).

strings: Strings

The interface texts.

when: When

The viewer’s locale, time zone and clock.

interface FormFieldProps

What your own form field gets.

field: any

The field as sent (id, label, type, config, …).

value: unknown

Its value now.

onChange(value: unknown): void

Sets its value.

disabled: boolean

Whether it can’t be changed (sent, or not for this person).

error?: string

The message when its value is not valid.

strings: Strings

The interface texts.

interface StepsProps

What a replacement Steps gets.

steps: Step[]

The steps, in order.

strings: Strings

The interface texts.

interface InboxDetailProps

What a custom inbox detail gets.

item: InboxItem

The item (a request, a draft, a hand-off, or yours).

inbox: InboxState

The inbox, to act: decide, answer, approveDraft, discardDraft, handBack.

strings: Strings

The interface texts.

when: When

The viewer’s locale, time zone and clock.

outcome?: InboxOutcome

What happened to it here, once handled.

onOpen?(convId: string): void

Opens its conversation in your app.