AI Primitives

Components / Content / Markdown

Markdown

Streaming-safe markdown renderer with GFM support and code blocks built in.

Installation

Install the Markdown React component with the shadcn CLI (after adding the @ai-primitive registry and theme, see Installation):

npx shadcn@latest add @ai-primitive/markdown

Usage

import { Markdown } from "@/components/ui/markdown"

Related components

  • Response Stream - Animates text in token-by-token (typewriter) or word-by-word (fade).
  • JSX Preview - Renders a JSX string as live output, auto-closing open tags mid-stream.
  • Image - Displays a URL, base64, or raw-bytes image, with an animated placeholder while pending.
  • File Upload - A drag-and-drop dropzone that overlays the whole page while a file is dragged over it.

Previous: Source · Next: Response Stream