Skip to content

useStreamingText

@astryxdesign/core v0.7.1 · useStreamingText

Parameters ​

NameTypeDefaultDescription
targetTextMaybeRefOrGetter<string>—The full target text to reveal. As new chunks arrive, update this value with the accumulated text.
isStreamingMaybeRefOrGetter<boolean>falseWhether text is currently being streamed. When false, the hook returns the full targetText immediately.
optionsMaybeRefOrGetter<UseStreamingTextOptions>—Optional configuration for streaming behavior.
options.speed'natural' | 'fast' | 'instant''natural'Speed preset for text reveal. natural reveals a short run at each motion tick, fast ticks twice as often so it drains the backlog sooner, and instant returns the full text with no animation.

Returns ​

NameTypeDescription
displayedTextComputedRef<string>The portion of targetText to render. Grows steadily toward the full targetText during streaming, or equals targetText when not streaming.