Concrete
GuidesCompose a template

Build a rendered-format template

The deliverable is a deck, a social post or a print sheet rather than a website.

Goal

A template whose pages are slides: fixed geometry, no URLs, and a stylesheet the renderer can reach without a network.

Prerequisites

  • The workspace Start leaves you with — a website template is the starting point; this changes its class.
  • Formats for the library of sizes, and Pages and composition for what a page is.

Steps

Declare the format

format is what decides the artifact class, and nothing else does:

template.ts
import { deck16x9, defineTemplate, type PageComponent } from "@homepages/concrete";
import icon from "./icon.svg";

declare const Cover: PageComponent;
declare const Rooms: PageComponent;

export default defineTemplate({
  key: "my-deck",
  name: "My Deck",
  format: deck16x9,
  icon,
  scope: "global",
  pages: {
    cover: { label: "Cover", page: Cover },
    rooms: { label: "Rooms", page: Rooms },
  },
});

Each page is one slide, in the order declared. A rendered page carries no path — a slide has no URL — and the type follows format, so a leftover path fails to compile rather than failing at publish.

A rendered template may declare a list of formats, as long as they are all of one class: format: [instagramPortrait, instagramSquare] renders the same pages at both crops. A deck beside a social post is two classes and is refused.

Leave the frame to the host

A page still places sections and nothing else. The frame around them — the window that is exactly the format's bleed box, the geometry custom properties (--frame-w, --frame-h, --frame-bleed), the data-format stamp — is emitted by whatever is rendering: the playground, the capture, the publisher. FrameShell is the primitive that defines that markup, and it is the platform's to render.

pages/cover.tsx
import { fact, fill, Section, section, Slot, text } from "@homepages/concrete";

const heading = text.medium({
  label: "Heading",
  cap: 60,
  source: fill.write({
    reads: [fact.property.description],
    brief: "Name what makes the property worth seeing. Write one sentence. Confident and specific.",
  }),
});

const Title = section(
  { key: "title", label: "Title", slots: { heading } },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.heading} as="h1" />
    </Section>
  ),
);

export const Cover = () => <Title />;

Root the page at FrameShell yourself and the page probe finds markup that is not a section — pages/non-section-markup, naming the frame element it found. Sections stack as a rigid column inside the frame, so an overflowing slide overflows measurably instead of being silently squeezed.

Size to the frame, not to a breakpoint

The frame is the viewport, so viewport units and geometry media queries are the primary vocabulary and a hard-coded pixel breakpoint is style/no-px-breakpoint. Design to the bleed box and keep anything that must survive trimming away from the edge.

Say which destination with a format variant

Every declared format id becomes a Tailwind variant, derived from format and never written by you: deck-16x9:px-24 applies exactly when the page renders at that format.

import { fact, fill, Section, section, Slot, text } from "@homepages/concrete";

const heading = text.medium({
  label: "Heading",
  cap: 60,
  source: fill.write({
    reads: [fact.property.description],
    brief: "Name what makes the property worth seeing. Write one sentence. Confident and specific.",
  }),
});

export const Title = section(
  { key: "title", label: "Title", slots: { heading } },
  ({ slot }) => (
    <Section className="px-8 deck-16x9:px-24">
      <Slot.Text slot={slot.heading} as="h1" />
    </Section>
  ),
);

Reach for one to state destination identity — the conventions of a feed, a story's safe area — never size. Two formats with the same pixels and different platforms are what this is for; a bigger sheet is geometry, and geometry has units.

Keep the stylesheet reachable

A rendered template's compiled stylesheet may reference no external URL: the renderer's page reaches nothing but its own bundle, so a hosted font silently becomes a fallback face in the artifact somebody prints.

globals.css
/* Refused on a rendered class:
   @import url("https://fonts.googleapis.com/css2?family=Inter"); */
@font-face {
  font-family: "Inter";
  src: url("./fonts/inter.woff2") format("woff2");
}

concrete check grades the compiled CSS, so an import three files deep is caught the same way:

✗ stylesheet (1 violation)
    globals.css  concrete/css/external-url
      a rendered template's stylesheet references https://fonts.googleapis.com/…,
      which the renderer cannot reach. Put the file in the workspace and reference
      it by a relative url(); it ships content-hashed with the stylesheet.

Verify

concrete check passes all thirteen stages — the composition, the stylesheet and the render over your fixtures, exactly as for a website.

In concrete dev, one canvas holds every page at once, each a frame at the format's geometry. A format switcher appears when the template declares more than one size, and a trim-and-bleed guides toggle when the format has a bleed to draw. There is no View live on a rendered class; the footer offers Download instead — a zip of the pages for an image format, a PDF for a document format, rendered from the fixture as authored.

On this page