Skip to content
Eskais UI

Agent tasks

Conversation

A chat or agent thread: a role="log" that follows new messages while the reader is at the end, stops when they scroll up and shows a "new below" pill that jumps back (smooth unless reduced motion), keeps a streaming message in view, loads older messages above without moving the view, and server renders. ConversationMessage is an article named by its author, with avatar, relative time and data-from (user, assistant, agent, system, tool); ConversationComposer composes Textarea and Button. Agents read messages and call jumpToLatest.

Example

System
Atlas joined the thread
You
Can you triage the failing checkout tests?
AT
Atlas
Three fail on the coupon step. The fixture expects a 10% discount, the API now returns 12%.
You
Update the fixture, not the API.
AT
Atlas
Done. The fixture now reads 12% and all three pass.

Installation

npx shadcn@latest add @eskais/conversation
npm packageslucide-react

Usage

Import
import { conversation, describeMessage } from "@/components/ui/conversation-primitive"import {  Conversation,  ConversationContext,  ConversationLoadOlder,  ConversationLog,  ConversationMessage,  ConversationNewBelow,  ConversationRoot,  conversationLabels,  conversationMessageLabels,  useConversation,} from "@/components/ui/conversation"import { ConversationComposer, conversationComposerLabels } from "@/components/ui/conversation-composer"

A chat or agent thread: messages in a log that follows the newest one, a pill when new ones arrive while the reader is scrolled up, and a composer.

API reference

ConversationRoot

Takes PartProps, ConversationOptions.

ConversationLog

Takes ComponentProps.

ConversationNewBelow

PropTypeDefault
labelsPartial<Pick<ConversationLabels, "newBelow" | "jumpToLatest">>–
childrenReactNode–

Also takes ComponentProps except children.

ConversationLoadOlder

Takes ComponentProps.

Conversation

PropTypeDefault
labelrequiredNames the log, for screen readers and agents.string–
labelsPartial<ConversationLabels>–
composerA `ConversationComposer`, below the log.ReactNode–
emptyShown in the log while it has no messages.ReactNode–
children`ConversationMessage`s, oldest first.ReactNode–

Also takes PartProps except children, ConversationOptions except children.

ConversationMessage

PropTypeDefault
fromrequiredWho sent it; styles it and becomes `data-from`."user" | "assistant" | "agent" | "system" | "tool"–
authorThe sender's name, shown above the message and naming it.ReactNode–
avatarAn `Avatar` or `AgentAvatar`, beside the message.ReactNode–
timeWhen it was sent, shown as a `RelativeTime`.Instant–
nowPass one `useNow()` per screen to every message's `now`.Instant–
localestring–
streamingStill arriving: `aria-busy`, so screen readers wait for the whole message.boolean–
actionsButtons under the message, like Copy or Retry.ReactNode–
messageIdIdentifies it to agents reading the log.string–
labelsA screen-reader name per role, used when there is no `author`.Partial<ConversationMessageLabels>–

Also takes <article> attributes except role.

ConversationComposer

PropTypeDefault
onSendrequiredSends the trimmed text. The field empties once it returns, or once a returned Promise resolves; return `false` (or resolve to it) to keep the text, like after a failed send.(text: string) => unknown–
labelsPartial<ConversationComposerLabels>–
placeholderstring–
disabledboolean–
submitShortcut`"enter"` (default): Enter sends and Shift+Enter starts a line. `"mod+enter"`: Cmd/Ctrl+Enter sends."enter" | "mod+enter""enter"
controllerReads and writes the field from outside, like a suggestion chip that fills it.InputController–
actionsMore controls beside Send, like an attach button.ReactNode–
classNamestring–

Other exports

conversationdescribeMessageConversationContextconversationLabelsconversationMessageLabelsuseConversationconversationComposerLabelstype ConversationMessageItemtype ConversationOptionstype ConversationApitype ConversationLabelstype ConversationMessageLabelstype ConversationMessagePropstype ConversationPropstype ConversationRoletype ConversationRootPropstype ConversationComposerLabelstype ConversationComposerProps

Accessibility

  • The thread is a named role=log, so screen readers announce new messages; it takes focus to scroll from the keyboard.
  • Each message is an article named by its author and time; one without an author is named by its role for screen readers.
  • A streaming message is aria-busy, so it is read once it is whole rather than a word at a time.
  • The new-below pill moves focus to the log when pressed, and the jump is instant under reduced motion.

Agent actions

Agents read the messages as the thread's items (author: text), call jumpToLatest and loadOlder, and send by setting the Message field and pressing Send.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.