Skip to main content

Components reference

All headless components across @agentskit/react and @agentskit/ink. Components emit data-ak-* attributes (React) or use Ink terminal primitives (Ink) — they carry no opinion about visual styling.

React components

Import from @agentskit/react:

import {
ChatContainer,
Message,
InputBar,
Markdown,
CodeBlock,
ToolCallView,
ThinkingIndicator,
} from '@agentskit/react'

ChatContainer

Scrollable wrapper. Attaches a MutationObserver and auto-scrolls to the bottom whenever children change.

<ChatContainer className="my-chat">
{/* messages, indicators */}
</ChatContainer>
PropTypeDefaultDescription
childrenReactNodeRequired. Message list and other content.
classNamestringExtra CSS class.

Emits: data-ak-chat-container


Message

Renders a single Message object from chat.messages.

<Message
message={msg}
avatar={<img src={userAvatar} alt="User" />}
actions={<button onClick={() => copy(msg.content)}>Copy</button>}
/>
PropTypeDescription
messageMessageTypeRequired. The message to render.
avatarReactNodeOptional avatar shown beside the bubble.
actionsReactNodeOptional action row below the content.

Emits: data-ak-message, data-ak-role, data-ak-status, data-ak-content, data-ak-avatar, data-ak-actions


InputBar

Textarea + send button wired to a ChatReturn object. Sends on Enter, inserts newline on Shift+Enter.

<InputBar
chat={chat}
placeholder="Ask anything..."
disabled={false}
/>
PropTypeDefaultDescription
chatChatReturnRequired. Return value from useChat.
placeholderstring'Type a message...'Textarea placeholder.
disabledbooleanfalseDisables input and button.

Emits: data-ak-input-bar, data-ak-input, data-ak-send


Markdown

Lightweight wrapper for markdown content. Add your own renderer (e.g. react-markdown) inside or replace this component entirely.

<Markdown content={msg.content} streaming={msg.status === 'streaming'} />
PropTypeDefaultDescription
contentstringRequired. Markdown string to display.
streamingbooleanfalseAdds data-ak-streaming="true" while streaming.

Emits: data-ak-markdown, data-ak-streaming


CodeBlock

Renders a code snippet with an optional copy button.

<CodeBlock code="npm install @agentskit/react" language="bash" copyable />
PropTypeDefaultDescription
codestringRequired. Source code to display.
languagestringLanguage hint (e.g. 'tsx', 'bash').
copyablebooleanfalseShows a Copy button that writes to the clipboard.

Emits: data-ak-code-block, data-ak-language, data-ak-copy


ToolCallView

Expandable view for a single tool call. Clicking the tool name toggles args and result visibility.

{msg.toolCalls?.map(tc => (
<ToolCallView key={tc.id} toolCall={tc} />
))}
PropTypeDescription
toolCallToolCallRequired. The tool call object from @agentskit/core.

Emits: data-ak-tool-call, data-ak-tool-status, data-ak-tool-toggle, data-ak-tool-details, data-ak-tool-args, data-ak-tool-result


ThinkingIndicator

Three animated dots with a label. Renders nothing when visible is false.

<ThinkingIndicator visible={chat.status === 'streaming'} label="Thinking..." />
PropTypeDefaultDescription
visiblebooleanRequired. Show or hide the indicator.
labelstring'Thinking...'Accessible label next to the dots.

Emits: data-ak-thinking, data-ak-thinking-dots, data-ak-thinking-label


Ink components

Import from @agentskit/ink:

import {
ChatContainer,
Message,
InputBar,
ToolCallView,
ThinkingIndicator,
} from '@agentskit/ink'

ChatContainer (Ink)

Wraps children in an Ink <Box flexDirection="column" gap={1}>.

<ChatContainer>
{chat.messages.map(msg => <Message key={msg.id} message={msg} />)}
</ChatContainer>
PropTypeDescription
childrenReactNodeRequired.

Message (Ink)

Renders the role label in a role-specific terminal colour, then the message content below it.

<Message message={msg} />
PropTypeDescription
messageMessageTypeRequired.

Role colours: assistant → cyan, user → green, system → yellow, tool → magenta.


InputBar (Ink)

Captures keyboard input via Ink's useInput. Sends on Enter, deletes on Backspace/Delete. Disabled while streaming.

<InputBar chat={chat} placeholder="Type and press Enter..." />
PropTypeDefaultDescription
chatChatReturnRequired.
placeholderstring'Type a message...'Shown above the input line.
disabledbooleanfalsePrevents input.

ToolCallView (Ink)

Renders a rounded border box with the tool name, status, and optionally the args and result.

<ToolCallView toolCall={tc} expanded />
PropTypeDefaultDescription
toolCallToolCallRequired.
expandedbooleanfalseShow args and result inline.

ThinkingIndicator (Ink)

Single-line yellow text. Renders nothing when visible is false.

<ThinkingIndicator visible={chat.status === 'streaming'} label="Thinking..." />
PropTypeDefaultDescription
visiblebooleanRequired.
labelstring'Thinking...'Text to display.

Component availability

Component@agentskit/react@agentskit/ink
ChatContainerYesYes
MessageYesYes
InputBarYesYes
ToolCallViewYesYes
ThinkingIndicatorYesYes
MarkdownYesNo
CodeBlockYesNo