Importing
AstroContainer.create
Create a new container instance.AstroContainerOptions
Example
renderToString
Render a component to an HTML string.AstroComponentFactory
required
The Astro component to render.
ContainerRenderOptions
Rendering options.
Request
Request object for the render. Used to populate
Astro.request and Astro.url.Record<string, string | undefined>
Route parameters for dynamic routes.
Record<string, any>
Props to pass to the component via
Astro.props.Record<string, any>
Slot content to pass to the component.
App.Locals
Locals object accessible via
Astro.locals.'page' | 'endpoint'
Type of route being rendered.Default:
'page'boolean
When
false, renders the component as a full page. When true, renders as a partial.Default: trueExample
renderToResponse
Render a component and return a Response object.renderToString, but returns a Response object instead of a string.
Example
addServerRenderer
Manually add a server renderer to the container.AddServerRenderer
required
Example
addClientRenderer
Manually add a client renderer to the container for components usingclient:* directives.
AddClientRenderer
required
Example
insertPageRoute
Register a page route in the container for use withAstro.rewrite().
string
required
The URL path that will render the component.
AstroComponentFactory
required
The component to render for this route.
Record<string, string | undefined>
Route parameters for dynamic routes.