Skip to content
Gx
GitHub

GX6010: construct that an email cannot hold

A component of an email package has a class, a signal, a client expression, an action invocation, an island or a script.

Cause

A component of a package with the name email is a part of an email. An email client runs no script, and it does not read the stylesheet of the site. These constructs do nothing in an email:

  • A class attribute or a class: directive.
  • A signal.
  • A client expression, for example show={$Open}.
  • An action invocation, for example on:click={route.Add{}}.
  • An island.
  • A script element.

gx.RenderEmail returns an error for the same constructs in a component of a different package.

Example

email/Notice.gx
package email

props {
  // Text is the text of the notice.
  Text string
}

<p class="text-sm">{p.Text}</p>

gx check reports:

gx check
email/Notice.gx:8:4: GX6010: a component of an email package has a class attribute on <p>; an email client runs no script and reads no stylesheet of the site

Fix

  1. Write the look in a style attribute: style="font-size:14px;color:var(--foreground)". gx.RenderEmail gives each var() the value of its theme token.
  2. Give a value as a prop, not as a signal.
  3. For an action, use a link to a page of the site. gx.RenderEmail makes the link an absolute URL.