Skip to content

[labs/ssr] Function to render a custom element #3656

@augustjk

Description

@augustjk

Should this be an RFC?

  • This is not a substantial change

Which package is this a feature request for?

SSR (@lit-labs/ssr)

Description

From #3605 (comment)

A function that takes a custom element tag name and attributes/props, and return some rendered results, like the template shadowroot with the proper attributes and contents, and reflected attributes for the host element can be generally useful outside of the React integration.

The implementation made for labs/ssr-react can be moved to labs/ssr for use in other SSR integrations where the input doesn't have to be a TemplateResult.

Some changes to consider for the general implementation:

  • Separating attributes and props arguments. In the ssr-react, we just get a single "props" object from React and use an in check to guess as to whether to set as property or as attribute. Perhaps other implementations will be able to distinguish those better.
  • Should take renderInfo as argument to override the default one, including the ability to provide additional renderers.

Alternatives and Workarounds

.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions