Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@kubb/renderer-jsx

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kubb/renderer-jsx

JSX-based renderer for Kubb. Provides a custom React runtime, reconciler, and built-in components (File, Function, Type, Const) for component-based, type-safe code generation.

latest
Source
npmnpm
Version
5.0.0-beta.35
Version published
Weekly downloads
6.8K
165.86%
Maintainers
1
Weekly downloads
 
Created
Source
Kubb banner

npm version npm downloads Coverage License Sponsors

Documentation · Report Bug · Request Feature


@kubb/renderer-jsx

JSX-based renderer for Kubb

Provides a custom React runtime, reconciler, and built-in components (File, Function, Type, Const) for component-based, type-safe code generation inside Kubb plugins.

Installation

bun add @kubb/renderer-jsx
# or
pnpm add @kubb/renderer-jsx
# or
npm install @kubb/renderer-jsx

Usage

Use the built-in components inside a Kubb plugin to emit generated files:

import { createRenderer } from '@kubb/renderer-jsx'
import { File, Function, Type } from '@kubb/renderer-jsx'

const renderer = createRenderer()

await renderer.render(
  <File baseName="petStore.ts" path="src/gen/petStore.ts">
    <File.Source>
      <Type name="Pet">{'{ id: number; name: string }'}</Type>
      <Function name="getPet" async>
        {"return fetch('/pets')"}
      </Function>
    </File.Source>
  </File>,
)

const files = renderer.files
renderer.unmount()

Built-in Components

ComponentDescription
<File>Declares a generated output file with its path and optional imports/exports
<File.Source>The source content block inside a <File>
<Function>Generates a TypeScript function declaration
<Type>Generates a TypeScript type alias
<Const>Generates a const variable declaration
<Jsx>Renders JSX expressions inside generated output
<Root>Root container for the renderer tree

API

createRenderer(options?)

Creates a new renderer instance.

const renderer = createRenderer({ debug: false })
await renderer.render(<MyComponent />)
const files = renderer.files  // FileNode[]
renderer.unmount()

jsxRenderer

Pre-built renderer instance for use directly in Kubb plugins as the jsxRenderer plugin option.

JSX Runtime

@kubb/renderer-jsx ships its own JSX runtime (jsx-runtime and jsx-dev-runtime). Configure your tsconfig.json to use it:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "@kubb/renderer-jsx"
  }
}

Supporting Kubb

Kubb is an open source project, and its development is funded entirely by sponsors. If you would like to become a sponsor, please consider:

My sponsors

License

MIT

Keywords

codegen

FAQs

Package last updated on 31 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts