āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/ibelick/prompt-kit/jsx-preview/page ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
import ComponentCodePreview from "@/components/app/component-code-preview" import { generateMetadata } from "../utils/metadata" import { JSXPreviewBasic } from "./jsx-preview-basic" import { JSXPreviewStreaming } from "./jsx-preview-streaming"
export const metadata = generateMetadata( "JSX Preview", "A component for rendering JSX strings as React components, with support for streaming content and automatic tag completion." )
A component for rendering JSX strings as React components, with support for streaming content and automatic tag completion.
The JSXPreview component can render JSX strings directly into React components.
<ComponentCodePreview component={<JSXPreviewBasic />} filePath="app/docs/jsx-preview/jsx-preview-basic.tsx" classNameComponentContainer="p-8" />
The isStreaming prop enables real-time rendering of JSX as it's being streamed, with automatic tag completion.
<ComponentCodePreview component={<JSXPreviewStreaming />} filePath="app/docs/jsx-preview/jsx-preview-streaming.tsx" classNameComponentContainer="p-8" hasReTrigger />
<CodeBlock
code={npx shadcn add "https://prompt-kit.com/c/jsx-preview.json"}
language="bash"
/>
<Step>Copy and paste the following code into your project.</Step>
<CodeBlock filePath="components/prompt-kit/jsx-preview.tsx" language="tsx" /><Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </Tabs>| Prop | Type | Default | Description |
| :---------- | :--------------- | :------ | :------------------------------------------------------------------- |
| jsx | string | | The JSX string to render |
| isStreaming | boolean | false | Whether the JSX is being streamed (enables automatic tag completion) |
| className | string | | Additional CSS classes |
| ...props | JsxParserProps | | All other props from react-jsx-parser |
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā