# RenderToStringOptions

**Kind:** Interface

**Source:** [`src/jsx/dom/server.ts`](https://github.com/honojs/hono/blob/main/src/jsx/dom/server.ts#L11)

**Part of:** [Jsx](subsystem-src-jsx)

`RenderToStringOptions` configures server-side JSX rendering to a string. Its `identifierPrefix` field sets a prefix for generated identifiers, helping separate IDs when rendering multiple independent trees.

## Properties

| Property | Type |
|---|---|
| `identifierPrefix` | `string` |

## Diagram

```mermaid
graph LR
  Options[RenderToStringOptions] --> Prefix[identifierPrefix: string]
  Prefix --> Renderer[Server-side JSX renderer]
  Renderer --> HTML[Rendered HTML string]
```

## Usage

```ts
import { renderToString } from "./jsx/dom/server";

const options: RenderToStringOptions = {
  identifierPrefix: "profile-",
};

const html = renderToString(<ProfileCard />, options);
```

## AI Coding Instructions

- Pass `identifierPrefix` when rendered output may share a document with other rendered trees.
- Keep the prefix stable between server rendering and client hydration when generated IDs must match.
- Use distinct prefixes for separate application roots to avoid identifier collisions.
- Treat `identifierPrefix` as a string value; do not pass `null` or omit it when the calling API requires options.

## How it works

`RenderToStringOptions` is an exported TypeScript interface for the second argument of `renderToString`. It declares one optional string property, `identifierPrefix`. [src/jsx/dom/server.ts:11-13]

`renderToString` defaults its `options` argument to `{}`. [src/jsx/dom/server.ts:21] At runtime, it checks whether `options` has any own enumerable keys; when it does, it writes `options are not supported yet` through `console.warn`. [src/jsx/dom/server.ts:22-24] The implementation does not read `identifierPrefix` or otherwise apply an option value while producing the string. [src/jsx/dom/server.ts:21-29]

The rendering call can throw `Error('Async component is not supported in renderToString')` if `element?.toString() ?? ''` does not result in a string; this behavior is independent of `RenderToStringOptions`. [src/jsx/dom/server.ts:25-28]

## Relationships

- IMPORTS → `renderToReadableStream`
