@gluonjs/ssr


@gluonjs/ssr / packages/ssr/src / ServerElementOptions

Interface: ServerElementOptions

Properties

children?

readonly optional children?: TemplateValue


properties?

readonly optional properties?: Readonly<Record<string, unknown>>


registry?

readonly optional registry?: GluonElementDefinitionRegistry

Example

Provide public element properties and light-DOM children when rendering a registered Gluon Element without browser connection hooks:

ts
import { GluonElement, defineElement, html } from '@gluonjs/core';
import { renderElement, renderToString, type ServerElementOptions } from '@gluonjs/ssr';

class ProductBadge extends GluonElement {
  static override readonly properties = { name: String };
  declare name: string;
  protected render() { return html`<strong>${this.name}</strong>`; }
}
defineElement('product-badge', ProductBadge);

const options = { properties: { name: 'Orbit Lamp' } } satisfies ServerElementOptions;
const template = renderElement(ProductBadge, options);
console.log(await renderToString(template));