@gluonjs/ssr / packages/ssr/src / ServerElementOptions
Interface: ServerElementOptions
Properties
children?
readonlyoptionalchildren?:TemplateValue
properties?
readonlyoptionalproperties?:Readonly<Record<string,unknown>>
registry?
readonlyoptionalregistry?:GluonElementDefinitionRegistry
Example
Provide public element properties and light-DOM children when rendering a registered Gluon Element without browser connection hooks:
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));