jsx-runtime.ts
17 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
Reference
fneach<T>(items: T[], render: (item: T, index: number) => JSXNode): JSXNodeMaps over an array and renders each item.
Maps over an array and renders each item.
Signature
export function each<T>(items: T[], render: (item: T, index: number) => JSXNode): JSXNode
Returns
Examples
{each(items, (item) => <li>{item.name}</li>)}
fnescapeHtml(str: string): stringEscapes HTML special characters to prevent XSS.
Escapes HTML special characters to prevent XSS.
Signature
function escapeHtml(str: string): string
Parameters
-
strstring
Returns
string
fnFragment({ children }: { children?: JSXChild }): JSXNodeFragment component - renders children without a wrapper element.
Fragment component - renders children without a wrapper element.
Signature
export function Fragment({ children }: { children?: JSXChild }): JSXNode
Returns
fnjsx(type: JSXElementType, props: JSXProps, _key?: string): JSXNodeCreates a JSX element. This is the core function called by the JSX transform.
Creates a JSX element. This is the core function called by the JSX transform.
Signature
export function jsx(type: JSXElementType, props: JSXProps, _key?: string): JSXNode
Parameters
-
typeJSXElementType -
propsJSXProps -
_keystringoptional
Returns
modulejsx-runtimeCustom JSX Runtime for Static HTML Generation This module provides a JSX runtime that outputs static HTML strings. No R…
Custom JSX Runtime for Static HTML Generation
This module provides a JSX runtime that outputs static HTML strings. No React, no hydration, no client-side JavaScript - just pure HTML.
Examples
// tsconfig.json or vite.config.ts
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@ox-content/vite-plugin"
}
}
typeJSXChild = string | number | boolean | null | undefined | JSXNode | JSXChild[]Valid JSX child types.
Valid JSX child types.
Signature
export type JSXChild = string | number | boolean | null | undefined | JSXNode | JSXChild[]
typeJSXElementType = string | ((props: Record<string, unknown>) => JSXNode)JSX element type - either a string (intrinsic) or a function component.
JSX element type - either a string (intrinsic) or a function component.
Signature
export type JSXElementType = string | ((props: Record<string, unknown>) => JSXNode)
interfaceJSXNodeJSX node - the result of JSX expressions.
JSX node - the result of JSX expressions.
Signature
export interface JSXNode
Members
Properties
| Name | Type | Description |
|---|---|---|
__html |
string |
interfaceJSXPropsProps with children.
Props with children.
Signature
export interface JSXProps
Members
Indexable
[key: string]: unknownProperties
| Name | Type | Description |
|---|---|---|
childrenoptional |
JSXChild |
fnjsxs(type: JSXElementType, props: JSXProps, key?: string): JSXNodeCreates a JSX element with static children. Called by the JSX transform for ele…
Creates a JSX element with static children. Called by the JSX transform for elements with multiple children.
Signature
export function jsxs(type: JSXElementType, props: JSXProps, key?: string): JSXNode
Parameters
-
typeJSXElementType -
propsJSXProps -
keystringoptional
Returns
fnraw(html: string): JSXNodeCreates raw HTML without escaping. Use with caution - only for trusted content.
Creates raw HTML without escaping. Use with caution - only for trusted content.
Signature
export function raw(html: string): JSXNode
Parameters
-
htmlstring
Returns
Examples
<div>{raw('<strong>Bold</strong>')}</div>
fnrenderAttr(name: string, value: unknown): stringRenders an attribute value to a string.
Renders an attribute value to a string.
Signature
function renderAttr(name: string, value: unknown): string
Parameters
-
namestring -
valueunknown
Returns
string
fnrenderChildren(children: JSXChild): stringRenders children to HTML string.
Renders children to HTML string.
Signature
function renderChildren(children: JSXChild): string
Parameters
-
childrenJSXChild
Returns
string
fnrenderToString(node: JSXNode): stringRenders a JSX node to an HTML string.
Renders a JSX node to an HTML string.
Signature
export function renderToString(node: JSXNode): string
Parameters
-
nodeJSXNode
Returns
string
fntoHtmlAttr(name: string): stringConverts a camelCase attribute name to kebab-case for HTML. Special handling fo…
Converts a camelCase attribute name to kebab-case for HTML. Special handling for data- and aria- attributes.
Signature
function toHtmlAttr(name: string): string
Parameters
-
namestring
Returns
string
variableconst VOID_ELEMENTS = new Set([ "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr", ])Custom JSX Runtime for Static HTML Generation This module provides a JSX runtim…
Custom JSX Runtime for Static HTML Generation
This module provides a JSX runtime that outputs static HTML strings. No React, no hydration, no client-side JavaScript - just pure HTML.
Signature
const VOID_ELEMENTS = new Set([
"area",
"base",
"br",
"col",
"embed",
"hr",
"img",
"input",
"link",
"meta",
"param",
"source",
"track",
"wbr",
])
Examples
// tsconfig.json or vite.config.ts
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@ox-content/vite-plugin"
}
}
fnwhen(condition: boolean, content: JSXNode): JSXNodeConditionally renders content.
Conditionally renders content.
Signature
export function when(condition: boolean, content: JSXNode): JSXNode
Parameters
-
conditionboolean -
contentJSXNode
Returns
Examples
{when(isLoggedIn, <UserMenu />)}