Skip to content
Functiondiscord-component-embedv1.1.0

toComponentEmbed

Converts a Container tree into the JSON document Discord reads for a component embed. To write the JSON into a page, use toComponentEmbedJson or toComponentEmbedScript. Both escape it for a <script> tag.

Throws:

toComponentEmbed(root: EmbedElement): ComponentEmbedPayload