Skip to content
Functiondiscord-component-embedv1.1.1

h

Builds an element without JSX. Use it in any file that can't compile this package's JSX, like a Svelte server file. Pass a component, its props, then its children.

h<Props>(
    type: (props: Props) => EmbedNode,
    props: object extends OwnProps<Props>
        ? OwnProps<Props> | null
        : OwnProps<Props>,
    children: ChildrenOf<Props>
): EmbedElement
const preview = h(
    Container,
    { accentColor: 0xf8f6e8 },
    h(
        Section,
        { accessory: h(LinkButton, { url: page.url, label: 'Read' }) },
        h(TextDisplay, null, `# ${page.title}`)
    )
);

Props

Props