Components

StreamingText

Wraps streaming LLM output with an optional animated cursor indicator.

Category: AI / Chat / Standalone

Import

import { StreamingText, type StreamingTextProps } from "@hareru/ui"

Exports

NameTypeDescription
StreamingTextComponentStreaming text wrapper (<output>)
StreamingTextPropsTypeProps interface

Key Props

PropTypeDefaultDescription
streamingbooleanfalseWhether text is currently streaming
cursor"blink" | "pulse" | "none""blink"Cursor animation style (only visible when streaming)

States

StateTypeValuesDefaultCSS Reflection
streamingboolean

Accessibility

  • Semantic elements: output
  • Live region: Yes (screen readers announce changes automatically)
  • Notes: Uses output element with aria-live="polite" for streaming text.

Usage

import { StreamingText } from "@hareru/ui"

// Streaming state with blinking cursor
<StreamingText streaming>
  The answer to your question is...
</StreamingText>

// Streaming complete
<StreamingText streaming={false}>
  The answer to your question is 42.
</StreamingText>

// Pulse cursor style
<StreamingText streaming cursor="pulse">
  Generating response...
</StreamingText>

// No cursor
<StreamingText streaming cursor="none">
  {tokens.join("")}
</StreamingText>

Notes

  • Renders as an <output> element with aria-live="polite" for screen-reader announcements.
  • Token-by-token rendering is managed by the caller — pass accumulated text as children.
  • The cursor is only rendered when streaming is true and cursor is not "none". The cursor element is hidden with aria-hidden="true".

On this page