Home / Type/ ContainerRenderOptions Type — astro Architecture

ContainerRenderOptions Type — astro Architecture

Architecture documentation for the ContainerRenderOptions type/interface in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  4996391c_022f_6d28_3191_3a9e9b747814["ContainerRenderOptions"]
  3e7d5a30_05d3_8677_9bbe_dc57d1b07ace["index.ts"]
  4996391c_022f_6d28_3191_3a9e9b747814 -->|defined in| 3e7d5a30_05d3_8677_9bbe_dc57d1b07ace
  style 4996391c_022f_6d28_3191_3a9e9b747814 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/container/index.ts lines 48–112

export type ContainerRenderOptions = {
	/**
	 * If your component renders slots, that's where you want to fill the slots.
	 * A single slot should have the `default` field:
	 *
	 * ## Examples
	 *
	 * **Default slot**
	 *
	 * ```js
	 * container.renderToString(Component, { slots: { default: "Some value"}});
	 * ```
	 *
	 * **Named slots**
	 *
	 * ```js
	 * container.renderToString(Component, { slots: { "foo": "Some value", "bar": "Lorem Ipsum" }});
	 * ```
	 */
	slots?: Record<string, any>;
	/**
	 * The request is used to understand which path/URL the component is about to render.
	 *
	 * Use this option in case your component or middleware needs to read information like `Astro.url` or `Astro.request`.
	 */
	request?: Request;
	/**
	 * Useful for dynamic routes. If your component is something like `src/pages/blog/[id]/[...slug]`, you'll want to provide:
	 * ```js
	 * container.renderToString(Component, { params: ["id", "...slug"] });
	 * ```
	 */
	params?: Record<string, string | undefined>;
	/**
	 * Useful if your component needs to access some locals without the use a middleware.
	 * ```js
	 * container.renderToString(Component, { locals: { getSomeValue() {} } });
	 * ```
	 */
	locals?: App.Locals;
	/**
	 * Useful in case you're attempting to render an endpoint:
	 * ```js
	 * container.renderToString(Endpoint, { routeType: "endpoint" });
	 * ```
	 */
	routeType?: RouteType;

	/**
	 * Allows to pass `Astro.props` to an Astro component:
	 *
	 * ```js
	 * container.renderToString(Endpoint, { props: { "lorem": "ipsum" } });
	 * ```
	 */
	props?: Props;

	/**
	 * When `false`, it forces to render the component as it was a full-fledged page.
	 *
	 * By default, the container API render components as [partials](https://docs.astro.build/en/basics/astro-pages/#page-partials).
	 *
	 */
	partial?: boolean;
};

Frequently Asked Questions

What is the ContainerRenderOptions type?
ContainerRenderOptions is a type/interface in the astro codebase, defined in packages/astro/src/container/index.ts.
Where is ContainerRenderOptions defined?
ContainerRenderOptions is defined in packages/astro/src/container/index.ts at line 48.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free