Alwurts

JSX Renderer

Component

About

A component that dynamically renders a JSX string at runtime, with error boundaries, incomplete-tag auto-closing for streaming output, and injectable custom components like shadcn UI or lucide icons.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds JSX Renderer to your project and fits it to your theme.

Code

How JSX Renderer is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { JsxRenderer } from "@/components/ui/jsx-renderer";

const jsxCode = `
<div className="p-6 rounded-lg bg-card border border-border">
  <h2 className="text-lg font-semibold text-foreground">Hello from JSX Renderer</h2>
  <p className="text-sm text-muted-foreground mt-2">
    This content is rendered dynamically from a JSX string at runtime.
  </p>
  <button className="mt-4 px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-sm">
    Click me
  </button>
</div>
`;

export default function Demo() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <JsxRenderer jsx={jsxCode} />
    </div>
  );
}

Dependencies

More by Alwurts

View all
  • Chat Input

    Chat Input

    303
  • Tool Invocation

    Tool Invocation

    46
  • Model Selector

    Model Selector

    41
  • Chat Suggestions

    Chat Suggestions

    13
  • Status Edge

    Status Edge

    7
  • Tool Call

    Tool Call

    4
  • Editable Handle

    Editable Handle

    1

Explore more

Part of simple-ai — browse the full library on 21st.dev.