The @tanstack/markdown/react entry requires React 18 or newer.
import {
Markdown,
renderBlockReact,
renderInlineReact,
renderMarkdownReact,
type MarkdownComponentProps,
type MarkdownComponents,
type MarkdownProps,
type MarkdownReactOptions,
} from '@tanstack/markdown/react'Returns React.ComponentPropsWithoutRef<TagName> for an intrinsic tag name. Use it when declaring a replacement separately from a component map.
An opt-in authoring type that maps known intrinsic tag names to another tag or a component with matching intrinsic props. It also accepts arbitrary string keys for extension component tags. Use it with satisfies to get element-specific inference without narrowing the renderer's backwards-compatible input contract.
Extends RenderOptions with:
interface MarkdownReactOptions extends RenderOptions {
components?: Partial<
Record<string, string | React.ComponentType<any>>
>
}components replaces an emitted intrinsic or custom element by tag name. Its accepted input remains permissive for backwards compatibility; MarkdownComponents provides stricter opt-in validation.
Extends MarkdownReactOptions with children: MarkdownInput.
function Markdown(props: MarkdownProps): ReactElementRenders the document children inside a React fragment.
function renderMarkdownReact(
input: MarkdownInput,
options?: MarkdownReactOptions,
): ReactNodeReturns rendered React nodes without JSX component syntax.
function renderBlockReact(
node: BlockNode,
options?: MarkdownReactOptions,
key?: string,
): ReactElementRenders one block node. key is available for custom tree composition; normal document rendering supplies deterministic positional keys.
function renderInlineReact(
node: InlineNode,
options?: MarkdownReactOptions,
key?: string,
): ReactNodeRenders one inline node.
See the React Guide for component mapping and SSR usage.