Sections and layout

Grid

Its children in columns of equal width, row after row; on phones, one under another.

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

Example

Show the code
grid.tsx
import { Column, Email, Grid, Text } 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 }}>
        <Grid columns={3} style={{ gap: 12 }}>
          {["Email", "Page", "Document", "Canvas", "PDF", "Image"].map((name) => (
            <Column key={name} style={{ backgroundColor: "#f1f5f9", borderRadius: 8, padding: 16 }}>
              <Text style={{ fontWeight: 600, textAlign: "center" }}>{name}</Text>
            </Column>
          ))}
        </Grid>
      </Column>
    </Email>
  );
}

Reference

Its children in columns of equal width, row after row; on phones, one under another.

Holds: Row, Column, Grid, Layer, Svg, Text, Heading, Link, Button, Image, Divider, List, Table, Video, Social, Menu, Html. Drawn in: email, page.

Props:

  • columns: an integer from 1 to 12 (default 2). How many children to a row.
  • stackOnMobile: true or false (default true). Its children one under another on phones (in an Email or a Page).

style:

  • color: color (inherited)
  • fontFamily: fontFamily (inherited)
  • fontSize: a length (a number of px) (inherited)
  • fontWeight: fontWeight (inherited)
  • fontStyle: one of “normal”, “italic” (inherited)
  • lineHeight: lineHeight (inherited)
  • letterSpacing: a length (a number of px) (inherited)
  • textAlign: one of “left”, “center”, “right”, “justify” (inherited)
  • textTransform: one of “none”, “uppercase”, “lowercase”, “capitalize” (inherited)
  • width: a length (a number of px, %)
  • minWidth: a length (a number of px, %)
  • maxWidth: a length (a number of px, %)
  • height: a length (a number of px)
  • padding: insets
  • backgroundColor: color
  • border: border
  • borderRadius: radius
  • overflow: one of “visible”, “hidden”. Whether content past a set height is cut off.
  • gap: a length (a number of px). Space between its children, across and down (unless rowGap is set).
  • rowGap: a length (a number of px). Space between its rows (gap by default); on phones, where the children stack, gap is between them.
  • alignItems: one of “start”, “center”, “end”, “stretch”. Where each child sits in its row’s height, as CSS align-items.
  • flex: flex. In a Row: its share of the width left after children with a width (default 1); “none” takes its own size.

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