Blocks

Heading

A heading, from level 1 (the page's title) to 6. The Heading element's props, styles and an example, in Hyper Elements.

import { Heading } from "@hyper-elements/react";

Example

Show the code
heading.tsx
import { Column, Email, Heading } from "@hyper-elements/react";

export default function Example() {
  return (
    <Email width={520} style={{ backgroundColor: "#ffffff", fontFamily: "Inter, Helvetica, Arial, sans-serif", color: "#0f172a", gap: 16 }}>
      <Column style={{ padding: 24, gap: 16 }}>
        <Column style={{ gap: 6 }}>
          <Heading level={1} style={{ fontSize: 32, letterSpacing: -0.5, mobile: { fontSize: 26 } }}>
            Ship emails like code
          </Heading>
          <Heading level={2} style={{ fontSize: 20, color: "#475569", fontWeight: 500 }}>
            A level-2 heading under it
          </Heading>
      </Column>
      </Column>
    </Email>
  );
}

Reference

A heading, from level 1 (the page’s title) to 6.

Holds: text; PageNumber, Span, Link, LineBreak, MergeTag.

Props:

  • level: one of 1, 2, 3, 4, 5, 6 (default 1)
  • dir: one of “ltr”, “rtl”, “auto”. Its text’s direction, where it differs from the design’s; it starts on that side unless aligned otherwise.
  • fit: { sizes, maxLines } (only in Canvas). In a Canvas: sizes it may be drawn at (a list of px, or { min, max, step }), largest first, and the lines it may take (maxLines). The image draws the largest size that fits.

style:

  • color: color (inherited, Typography)
  • fontFamily: fontFamily (inherited, Typography)
  • fontSize: a length (a number of px) (inherited, Typography)
  • fontWeight: fontWeight (default 700, inherited, Typography)
  • fontStyle: one of “normal”, “italic” (inherited, Typography)
  • lineHeight: lineHeight (default 1.25, inherited, Typography)
  • letterSpacing: a length (a number of px) (inherited, Typography)
  • textAlign: one of “left”, “center”, “right”, “justify” (inherited, Typography)
  • textTransform: one of “none”, “uppercase”, “lowercase”, “capitalize” (inherited, Typography)
  • textDecoration: one of “none”, “underline”, “line-through” (Typography)
  • width: a length (a number of px, %) (Size)
  • maxWidth: a length (a number of px, %) (Size)
  • padding: insets (Spacing)
  • backgroundColor: color (Background)
  • border: border (Border)
  • borderRadius: radius (Border)
  • flex: flex (Layout). In a Row: its share of the width left after children with a width (default 1); “none” takes its own size.

style.mobile (on phones): fontSize, lineHeight, letterSpacing, textAlign, width, maxWidth, padding, border.