```js
// @noErrors
import { render } from 'svelte/server';
```
## render
Only available on the server and when compiling with the `server` option.
Takes a component and returns an object with `body` and `head` properties on it, which you can use to populate the HTML when server-rendering your app.
```dts
function render<
Comp extends SvelteComponent
| Component,
Props extends ComponentProps = ComponentProps
>(
...args: {} extends Props
? [
component: Comp extends SvelteComponent
? ComponentType
: Comp,
options?: {
props?: Omit;
context?: Map;
idPrefix?: string;
csp?: Csp;
transformError?: (
error: unknown
) => unknown | Promise;
}
]
: [
component: Comp extends SvelteComponent
? ComponentType
: Comp,
options: {
props: Omit;
context?: Map;
idPrefix?: string;
csp?: Csp;
transformError?: (
error: unknown
) => unknown | Promise;
}
]
): RenderOutput;
```
## Csp
```dts
type Csp = { nonce?: string; hash?: boolean };
```
## RenderOutput
```dts
type RenderOutput = SyncRenderOutput &
PromiseLike;
```
## Sha256Source
```dts
type Sha256Source = `sha256-${string}`;
```
## SyncRenderOutput
```dts
interface SyncRenderOutput {/*…*/}
```
```dts
head: string;
```
HTML that goes into the ``
```dts
html: string;
```
- deprecated use `body` instead
```dts
body: string;
```
HTML that goes somewhere into the ``
```dts
hashes: {
script: Sha256Source[];
};
```