Sign in Get 3 free credits

Try a job or a niche: tiktok captions, study notes, excel formulas. Press Esc to close.

Hyper elements

Write emails, web pages, printed documents, PDFs and images in code with Hyper Elements (@hyper-elements/react).

Safety check

  • Claude rated it 6 out of 10, under our bar of 7, so we do not sell it. It is a free link to its author.

An automated scan lowers risk but cannot promise zero risk. How we check skills

Preview

The first lines of SKILL.md
---
name: hyper-elements
description: Write emails, web pages, printed documents, PDFs and images in code with Hyper Elements (@hyper-elements/react), React components that render email-safe HTML, responsive page HTML, print HTML, PDFs and PNG or SVG images. Use when writing or changing an Elements design, or when asked to build an email, page, document, PDF or image in code with Elements.
---

# Hyper Elements

<!-- Written from the element definitions by packages/react/src/primitives/reference.ts: don't edit by hand. Regenerate with UPDATE_REFERENCE=1 pnpm --filter @hyper-elements/react test reference -->

Write emails, web pages, printed documents, PDFs and images in code with Hyper Elements (`npm install @hyper-elements/react`). This is the package's own guide to its elements at `@hyper-elements/react` (GUIDE.md in the package), written from their definitions: everything needed to write a design, in short. Every prop's and style's details, with its default: `node_modules/@hyper-elements/react/REFERENCE.md`.

To test an email in Outlook, Gmail and other clients, a design or any HTML: the `email-testing` skill has the steps, or run `npx @hyper-elements/cli preview emails/welcome.tsx`.

## Before you write a design

- If the project's package.json doesn't list `@hyper-elements/react`, install it: `npm install @hyper-elements/react react react-dom`, or the same with the project's package manager (`pnpm add`, `yarn add`, `bun add`).
- Once it's installed, its own guide is `node_modules/@hyper-elements/react/GUIDE.md`, written for the version installed. `grep "hyper-elements guide" node_modules/@hyper-elements/react/GUIDE.md` gives its id; this skill's is `hyper-elements guide f82a37d3`. The same id: this skill is that guide, so read on. Another id, or none: read GUIDE.md and follow it where it differs from this skill.

## Templates from Unlayer Elements

A project may have templates written with Unlayer Elements: they import `Body`, `ColumnLayouts` or `renderToHtml()` from `@unlayer/react-elements`, and use `values`, `layout`, `html` and style props such as `backgroundColor="#fff"`. Those components aren't in Hyper Elements, a new package: these are its components.

- Move them with the codemod: `npx @hyper-elements/migrate src/emails --from unlayer-elements` lists what it would change, `--write` replaces the files (only those git can restore) and `--report notes.md` writes what it noted. It rewrites the imports and the JSX, and keeps props, loops and conditions. The new elements render with `await render(element)`, which is async, in place of `renderToHtml()`. More: `npx @hyper-elements/migrate --help`.
- What the codemod can't move is listed, and the file is left as it was: rewrite that part by hand with these elements.
- Then `npm install @hyper-elements/react`, and remove `@unlayer/react-elements` once nothing imports it.
- Templates in React Email: `npx @hyper-elements/migrate src/emails` writes them in these elements and checks each against its original.

## How a design is written

- Import from `@hyper-elements/react`. A design has one root: `Email`, `Page`, `Document` or `Canvas`.
- Styles go in `style={{ … }}`, never as props: `<Heading style={{ fontSize: 24, color: "#111827" }}>`. A number is px; `padding` takes `16`, `[12, 24]` or `"12px 24px"`. A box's text styles are inherited by what it holds.
- There are no margins: space between blocks is their parent's `gap` (`<Column style={{ gap: 16 }}>`), space inside a box its `padding`.
- A root, a `Section` and a `Column` stack their children. A `Row` puts its children side by side (each `Column` at its `style.width`, or an equal share) and stacks them on phones. `Grid columns={3}` makes rows of three. A `Section` is a band whose background spans the window; a `Column` with a background is a card.
- Text is elements, not HTML: `Heading level={1}` and `Text` hold text; inside them `Span` styles a run, `Link href` links one, `LineBreak` breaks the line and `MergeTag name` writes a merge tag. No raw HTML (`<b>`, `<br>`, `<div>`) and no `html` prop.
- `Image src={{ src, width, height }}` (the file's size in px) with `alt`; `style.width` sets the size shown.
- An image's `src` is a public `https` URL the reader's email client can fetch: the project's own (its CDN, its other templates, its site) or one the person gives you. Never make one up: `example.com`, a guessed path or a file on this computer shows as a broken image. Where the design needs an image that doesn't exist yet, use a placeholder that loads, at the image's size: `https://placehold.co/1200x600/png?text=Product+screenshot` (width x height in px). Then tell the person which images to replace. A `data:` URI works in a Page, Document or Canvas, but Gmail doesn't show one in an Email.
- Lists: `<List type="number">` of `ListItem`s. Tables: a `Table` of `TableRow`s (`header` on the first) of `TableCell`s, with `cellPadding` and `rowBorder` in the Table's `style`.
- Phones: `style={{ fontSize: 24, mobile: { fontSize: 20 } }}` (the styles listed under "Phones", where `text` is fontSize, lineHeight, letterSpacing and textAlign), `hidden={{ mobile: true }}`; in an Email or a Page. Hover: `style={{ hover: { backgroundColor: "#374151" } }}` (those under "Hover").
- `await render(element)` gives `{ html, text, diagnostics }`; errors throw an `ElementsError` with the same `diagnostics`. `validate(element)` runs the checks without rendering; `outline(element)` prints the laid-out design (each block, its width, its text).
- Templates (fixed parts, typed fields and checks): `@hyper-elements/react/template`.
...

From hyper-elements's repository, MIT licence.

Related skills

  • Checked

    PDF toolkit

    Reads, creates, merges, splits, fills and watermarks PDF files, and pulls the text and tables out of them.

    by HKUDS 65k
    7/101 credit
  • Checked

    Word document builder

    Reads, creates and edits Word documents, including tables, contents pages, tracked changes and comments.

    by HKUDS 65k
    8/101 credit
  • Checked

    Official form explainer

    Explains an official form field by field: what to write, documents needed, the deadline and where to send it.

    by mohitagw15856 1.6k
    7/101 credit
  • Checked

    Arc42 architecture docs

    Writes arc42 software architecture documents with clear links between decisions, risks and technical debt.

    by LLM-Coding 549
    7/101 credit
  • Checked

    Incident postmortem writer

    Writes blameless incident postmortems with fishbone and five whys analysis, so the team fixes root causes.

    by github 42k
    8/101 credit
  • Checked

    Plain language docs

    Rewrites docs and notes in plain English with short active sentences, so anyone can follow them first time.

    by AminBlg 4.7k
    8/101 credit

Secure checkout

Credits

AUD

  1. 1Choose
  2. 2Pay on Square
  3. 3Credits added