AI Response Card

A self-contained card that displays an AI-generated response. Includes a header with optional model badge and timestamp, action buttons for copying and regenerating, and thumbs up/down feedback. Supports a streaming cursor when isStreaming is true.

gpt-4o
2:41 PM
React is a JavaScript library for building user interfaces. It allows you to create reusable UI components and manage application state efficiently.

import { AIResponseCard } from "@aetherstack/patterns"

Installation

terminal
npx aether-ui add ai-response-card

Import

import.tsx
import { AIResponseCard } from "@aetherstack/patterns"

Usage

ai-response-card.tsx
import { AIResponseCard } from "@aetherstack/patterns"

export function MyResponseCard() {
  return (
    <AIResponseCard
      content="React is a JavaScript library for building user interfaces."
      model="gpt-4o"
      timestamp="2:41 PM"
      onCopy={() => navigator.clipboard.writeText(content)}
      onRegenerate={() => regenerate()}
      feedbackProps={{
        onThumbsUp: () => submitFeedback("up"),
        onThumbsDown: () => submitFeedback("down"),
      }}
    />
  )
}

Props

PropTypeDefaultDescription
content*stringThe response text content rendered inside the card.
isStreamingbooleanfalseShows an animated streaming cursor at the end of the content.
modelstringModel name shown as a badge in the card header.
timestampstringTimestamp string displayed in the card header.
onCopy() => voidCallback for the copy button. When omitted, the button is not rendered.
onRegenerate() => voidCallback for the regenerate button. When omitted, the button is not rendered.
feedbackProps{ onThumbsUp?: () => void; onThumbsDown?: () => void }Thumbs up/down feedback handlers. Buttons are rendered when handlers are provided.
classNamestringAdditional CSS classes applied to the card root.

* Required

Accessibility

  • Copy and regenerate buttons include descriptive aria-label attributes.
  • Feedback buttons use aria-pressed to convey toggled state to screen readers.
  • The streaming cursor is hidden from assistive technology with aria-hidden.