streamdown. Import them directly in your code:
StreamdownProps
The full props type for theStreamdown component. Extends Options (the react-markdown options type) with streaming-specific fields.
Options fields are:
The Markdown string to render.
Custom React components for HTML elements and the special
inlineCode key.Rehype plugins. Defaults to
defaultRehypePlugins.Remark plugins. Defaults to
defaultRemarkPlugins.Function
(element, index, parent) => boolean | null | undefined called for each element. Return false to remove.Allowlist of HTML element tag names. Elements not in the list are removed.
Blocklist of HTML element tag names. Elements in the list are removed.
When
true, raw HTML in the Markdown source is dropped.When
true, children of removed elements are kept (unwrapped) rather than deleted.Function
(url, key, node) => string | null | undefined applied to all URL attributes. Use to rewrite or block URLs.Options forwarded to
remark-rehype.BlockProps
Props for theBlock component (and any custom BlockComponent).
The raw Markdown string for this block.
Zero-based index of this block in the full block list.
true when streaming and this block contains an unclosed code fence.Mirrors
parseIncompleteMarkdown from the parent Streamdown.When
true, HTML indentation normalization is applied to content before rendering.Resolved text direction for this block.
Animate plugin instance for tracking previously-rendered character counts.
ControlsConfig
Configures which action controls appear on code blocks, tables, and Mermaid diagrams.boolean:
true— enable all controls on all block typesfalse— disable all controls on all block types
table, code, mermaid) can itself be true, false, or a fine-grained object:
Controls for table blocks.
Controls for code blocks.
Controls for Mermaid diagram blocks.
LinkSafetyConfig
Controls the link safety interstitial shown before the browser navigates to an external URL.When
true, clicking an external link shows a confirmation modal before navigation. When false, links behave normally.Optional async or synchronous function called with the URL before the modal is shown. Return
true to allow navigation immediately (skip the modal), or false to show the modal.Use this to implement an allowlist of trusted domains:Replaces the built-in modal with a custom React component. Called with
LinkSafetyModalProps when the modal should be shown.LinkSafetyModalProps
Props passed to a customrenderModal function.
Whether the modal should be visible.
Call this to close the modal without navigating.
Call this to confirm navigation and open the URL.
The URL the user clicked.
MermaidOptions
Options for Mermaid diagram rendering. Passed to themermaid prop on Streamdown.
Configuration object forwarded directly to Mermaid’s
initialize() call. Accepts any option from the Mermaid configuration reference.Custom component rendered when a Mermaid diagram fails to parse or render. Receives
MermaidErrorComponentProps.MermaidErrorComponentProps
Props provided to a custom Mermaid error component.The raw Mermaid diagram source that failed to render.
The error message from Mermaid.
Call this function to attempt rendering the diagram again. Useful if the failure is transient (e.g. the diagram was still being streamed when rendering was first attempted).
AllowedTags
allowedTags prop on Streamdown to extend the default rehype-sanitize schema.
AnimateOptions
Options for configuring word- or character-level entrance animations. Passed as theanimated prop on Streamdown (or to createAnimatePlugin directly).
The animation name. Built-in options are
"fadeIn", "blurIn", and "slideUp". You can pass any custom animation name as a string (e.g. one defined in your own CSS with a sd- prefixed keyframe).Duration of each token’s animation in milliseconds.
CSS easing function applied to each animated token (e.g.
"ease-in-out", "linear").Granularity of animation:
"word"— each word (and adjacent whitespace) is a separate animated unit"char"— each individual character is animated (whitespace is grouped)
Delay in milliseconds added between consecutive animated tokens, creating a cascading wave effect. The nth new token gets a delay of
n * stagger milliseconds.StreamdownContextType
The shape of the value provided byStreamdownContext.
Resolved controls configuration.
Whether the parent
Streamdown is currently animating.Whether code block line numbers are enabled.
Resolved link safety configuration.
Resolved Mermaid options.
The current rendering mode.
Active Shiki theme pair
[lightTheme, darkTheme].