# Streaming Text

Token-by-token streaming text with blinking cursor and optional typing animation



<ComponentPreview base="opentui" name="streaming-text-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-streaming-text
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="streaming-text" title="components/ui/streaming-text.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { StreamingText } from "@/components/ui/streaming-text";
```

```tsx
<StreamingText text="Installing dependencies..." animate speed={20} />
```

API Reference [#api-reference]

StreamingText [#streamingtext]

| Prop          | Type                         | Default |
| ------------- | ---------------------------- | ------- |
| `text`        | `string`                     | -       |
| `stream`      | `AsyncIterable<string>`      | -       |
| `cursor`      | `boolean`                    | `true`  |
| `animate`     | `boolean`                    | `false` |
| `speed`       | `number`                     | `30`    |
| `onComplete`  | `(fullText: string) => void` | -       |
| `cursorColor` | `string`                     | -       |
