StreamingText

Anima texto caractere a caractere com cursor piscante, simulando saída de streaming de LLM.

Demonstração

The quick brown fox jumps over the lazy dog.

Faster stream at 10ms per character.

Custom pipe cursor.

No cursor shown here.

Props

PropTipoPadrãoDescrição
textstringA string de texto completa para animar.
speednumber30Milissegundos entre cada caractere.
cursorbooleantrueExibir cursor piscante durante o streaming.
cursorCharstring'▋'Caractere usado como cursor.
onComplete() => voidChamado quando a animação termina.

Uso

import { StreamingText } from '@ghiberti85/ui'

// Basic usage
<StreamingText text="Hello, world!" />

// Custom speed and cursor
<StreamingText text="Fast stream" speed={10} cursorChar="|" />

// No cursor
<StreamingText text="No cursor" cursor={false} />

// With completion callback
<StreamingText
  text="Done!"
  onComplete={() => console.log('finished')}
/>

// Simulated LLM streaming
const [text, setText] = useState('')
// Update text as chunks arrive from your API
<StreamingText text={text} speed={1} />

Ver no Storybook

Abrir no Storybook
Ghiberti UI — Design System