AI Primitives

Components / Content / JSX Preview

JSX Preview

Renders a JSX string as live output, auto-closing open tags mid-stream.

Installation

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

npx shadcn@latest add @ai-primitive/jsx-preview

Usage

import { JSXPreview } from "@/components/ui/jsx-preview"

Related components

  • Markdown - Streaming-safe markdown renderer with GFM support and code blocks built in.
  • Response Stream - Animates text in token-by-token (typewriter) or word-by-word (fade).
  • 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: Response Stream · Next: Image