Interactive Components
Copy page
Render clickable components inside AI responses that programmatically send follow-up messages on the user's behalf.
Custom components let your agent render rich, interactive UI inside chat responses. Combined with chatFunctionsRef (React) or the widget instance (JavaScript), those components can programmatically submit follow-up messages when a user clicks them, creating guided, conversational workflows without the user needing to type.
How it works
- Your agent calls a tool that emits a component data part with a
type,name, andprops - The chat widget matches the component name to a render function you provide via the
componentsprop - Your render function builds the UI and calls
submitMessage()to send a message on the user's behalf
Setup
The pattern requires two things in your aiChatSettings:
components- a map of component names to render functions- A way to call chat methods like
submitMessagefrom inside those render functions. In React, use achatFunctionsRef. In JavaScript, use the widget instance returned byInkeep.EmbeddedChat().
When the agent emits a QuickActions component with an array of label/message pairs, the user sees clickable buttons. Clicking one sends that message as if the user typed it.
Example: clickable product cards
A more realistic example renders product or plan cards that let users drill into details with a single click.
When a user asks "What plans do you offer?", the agent calls its tool to emit PlanCard components. The user sees styled cards and can click any card to ask a targeted follow-up, creating a natural conversational flow.
Pre-filling the input
Instead of sending immediately, you can use updateInputMessage to pre-fill the input and let the user edit before sending. See the full list of available methods in the AIChatFunctions reference below.
Agent-side setup
For the agent to render these components, create data components in the Visual Builder. Each data component needs a name (matching the key in your components config) and a JSON schema defining its props.
Create the data components
Go to the Data Components tab in the left sidebar, then select New data component.
For the QuickActions component, use the following schema:
For the PlanCard component:
Add the data components to your sub agent
Open your agent's Sub Agent settings and add both data components. The agent will automatically use them when the conversation calls for it.
See Sub Agents for details on adding data components.
Register the components in your chat widget
Use the same component names as keys in your components config, as shown in the setup section above. The names must match exactly.
For more on data components, see Custom UI Blocks.
Custom tool approval UI
When an agent tool requires human approval before executing, the widget shows a default approval card. You can replace this with your own UI by registering an IkpTool component.
IkpTool receives three props:
tool- the tool invocation state (ToolUIPart).tool.typeis the tool name as provided by the widget, prefixed withtool-(e.g.tool-get_weather). Also includestool.state,tool.input,tool.output, andtool.approval.approve- a function to approve or deny the tool call. Callapprove(true)to approve,approve(false)to deny.renderMarkdown- a helper to render markdown strings. In React, returns a React element. In JavaScript, returns a React node (use plain text rendering instead for vanilla JS).
Tool states
| State | Meaning |
|---|---|
input-streaming | Tool input is being streamed |
input-available | Tool input is ready, execution pending |
approval-requested | Waiting for user to approve or deny |
approval-responded | User has responded, execution proceeding |
output-available | Tool has completed successfully |
output-error | Tool execution failed |
output-denied | User denied the tool call |
Example
IkpTool applies globally to all tool calls. To render different UI per tool, branch on tool.type:
AIChatFunctions reference
Prop
Type
Programmatically sends a message in the chat.
Type
(message?: string) => void
Parameters
message -
Optional message text. If omitted, sends the current input value.
Programmatically updates the text in the chat input field.
Type
(message: string) => void
Parameters
message -
The new message text to set
Resets the chat to its initial state. Removes all messages and resets the chat.
Type
() => void
Displays a form overlay in the chat interface.
Type
(formSettings: AIChatFormSettings, getHelpOption?: GetHelpOption) => void
Parameters
formSettings -
Configuration object defining the form's fields and behavior
getHelpOption -
Optional getHelpOption that triggered the form (for analytics)
Programmatically sets focus to the chat input field. Useful after programmatic updates or when showing the chat interface.
Type
() => void
Embedded Chat
Integrate Inkeep's embedded chat component directly into your JavaScript application for inline agent conversations.
App Credentials
How app credentials authenticate end-users, including anonymous sessions, authenticated chat sessions with asymmetric key verification, domain validation, and Proof-of-Work protection.