/
1.1k
Sponsor

Chat Message

Chat message bubble with role label, streaming indicator, and collapsible content

Terminal

Installation

$ pnpm dlx shadcn@latest add @termcn/ink/chat-message

Usage

import { ChatMessage } from "@/components/ui/chat-message";
<ChatMessage sender="assistant" name="Claude" timestamp={new Date()}>
  Here is the refactored version of your function.
</ChatMessage>

API Reference

ChatMessage

PropTypeDefault
sender"user" | "assistant" | "system" | "error"required
namestring-
timestampDate-
streamingbooleanfalse
collapsedboolean-
childrenReactNode-

Notes

Accessibility

termcn exposes the following behavior through Ink's terminal accessibility APIs. This is not a browser ARIA or general WCAG-conformance claim.

  • Keyboard: Enter / Space activate the focused action when enabled; Escape dismisses or cancels when supported; Tab / Shift+Tab move through Ink focus targets.
  • Focus and composition: Input is active only while the component's focus target is focused, enabled, active, and inside the topmost focus scope.
  • Screen reader: Ink labels and semantic state expose the component without relying on visual styling alone.