Marketing›Bento

marketing

Bento

Magazine-style bento grid of cells — heading depth sizes each tile, or author cells explicitly for full control

Install

  1. Add the package: npm install @refrakt-md/marketing
  2. Add it to the plugins array in refrakt.config.json: "plugins": ["@refrakt-md/marketing"]

About the plugin and its runes

Source

import Markdoc from '@markdoc/markdoc';
import type { Node, RenderableTreeNode } from '@markdoc/markdoc';
const { Ast, Tag } = Markdoc;
import {
	createComponentRenderable,
	createContentModelSchema,
	bodyOnly,
	RenderableNodeCursor,
	asNodes,
	stretchedLink,
	unwrapParagraphImages,
} from '@refrakt-md/runes';

const CELL_TITLE_LEVEL = 3;

function splitZones(nodes: Node[]): Node[][] {
	const zones: Node[][] = [[]];
	for (const n of nodes) {
		if (n.type === 'hr') zones.push([]);
		else zones[zones.length - 1].push(n);
	}
	return zones;
}

function zoneRoles(zones: Node[][]): { media: Node[]; body: Node[]; footer: Node[] } {
	if (zones.length === 1) return { media: [], body: zones[0], footer: [] };
	if (zones.length === 2) return { media: zones[0], body: zones[1], footer: [] };
	return { media: zones[0], footer: zones[zones.length - 1], body: zones.slice(1, -1).flat() };
}

export const bentoCellSections = { media: 'media', title: 'title', body: 'body' } as const;

export const bentoCell = createContentModelSchema({
	sections: bentoCellSections,
	provides: ['prose'],
	attributes: {
		size: { type: String, required: false },
		cols: { type: Number, required: false },
		rows: { type: Number, required: false },
		'media-position': {
			type: String,
			required: false,
			matches: ['top', 'bottom', 'start', 'end', 'cover'],
		},
		'content-height': {
			type: String,
			required: false,
			matches: ['sm', 'md', 'lg', 'xl'],
			description:
				'Override the grid content-height for this cell (column cells): pin its text area to sm/md/lg/xl',
		},
		'media-ratio': {
			type: String,
			required: false,
			matches: ['1/3', '2/5', '1/2', '3/5', '2/3'],
			description:
				"Override the grid media-ratio for this cell (beside cells): the media zone's share of the cell width",
		},
		href: { type: String, required: false },
	},
	contentModel: bodyOnly(),
	transform(resolved, attrs, config) {
		const all = asNodes(resolved.body);

		let titleNode: Node | undefined;
		let rest = all;
		if (all[0]?.type === 'heading') {
			titleNode = all[0];
			titleNode.attributes = { ...titleNode.attributes, level: CELL_TITLE_LEVEL };
			rest = all.slice(1);
		}

		const { media, body, footer } = zoneRoles(splitZones(rest));

		const children: RenderableTreeNode[] = [];
		const refs: Record<string, any> = {};
		const properties: Record<string, any> = {};

		const size = attrs.size ?? 'medium';
		const sizeMeta = new Tag('meta', { content: size });
		properties.size = sizeMeta;

		const fallback = presetSpans(size, 6);
		const cols = attrs.cols ? String(attrs.cols) : String(fallback.cols);
		const rows = attrs.rows ? String(attrs.rows) : String(fallback.rows);
		const colsMeta = new Tag('meta', { content: cols });
		const rowsMeta = new Tag('meta', { content: rows });
		properties.cols = colsMeta;
		properties.rows = rowsMeta;

		const contentHeightMeta = new Tag('meta', {
			content: (attrs['content-height'] as string) ?? '',
		});
		const mediaRatioMeta = new Tag('meta', { content: (attrs['media-ratio'] as string) ?? '' });
		properties['content-height'] = contentHeightMeta;
		properties['media-ratio'] = mediaRatioMeta;

		if (media.length > 0) {
			const mediaInner = unwrapParagraphImages(
				new RenderableNodeCursor(
					Markdoc.transform(media, config) as RenderableTreeNode[],
				).toArray() as RenderableTreeNode[],
			);
			const mediaDiv = new Tag(
				'div',
				{ 'data-section': 'media', 'data-name': 'media' },
				mediaInner,
			);
			refs.media = mediaDiv;
			children.push(mediaDiv);
		}

		let titleTag: InstanceType<typeof Tag> | undefined;
		if (titleNode) {
			const t = new RenderableNodeCursor(
				Markdoc.transform([titleNode], config) as RenderableTreeNode[],
			).toArray()[0];
			if (Markdoc.Tag.isTag(t)) {
				titleTag = t;
			}
		}
		const bodyInner = unwrapParagraphImages(
			new RenderableNodeCursor(
				Markdoc.transform(body, config) as RenderableTreeNode[],
			).toArray() as RenderableTreeNode[],
		);
		const bodyDiv = new Tag('div', { 'data-name': 'body' }, bodyInner);

		let footerTag: InstanceType<typeof Tag> | undefined;
		if (footer.length > 0) {
			const footerInner = new RenderableNodeCursor(
				Markdoc.transform(footer, config) as RenderableTreeNode[],
			).toArray() as RenderableTreeNode[];
			footerTag = new Tag('footer', { 'data-name': 'footer' }, footerInner);
		}

		if (titleTag) {
			refs.title = titleTag;
			children.push(titleTag);
		}
		refs.body = bodyDiv;
		children.push(bodyDiv);
		if (footerTag) {
			refs.footer = footerTag;
			children.push(footerTag);
		}

		const href = String(attrs.href ?? '');
		let linkTag: InstanceType<typeof Tag> | undefined;
		if (href) {
			linkTag = stretchedLink(href);
			refs.link = linkTag;
			children.push(linkTag);
		}

		const node = createComponentRenderable({
			rune: 'bento-cell',
			tag: 'div',
			properties,
			refs,
			children,
		});
		const defaultPosition = size === 'large' || size === 'full' ? 'start' : 'top';
		(node as any).attributes = {
			...(node as any).attributes,
			'data-media-position': attrs['media-position'] ?? defaultPosition,
		};
		return node;
	},
});

function tieredSize(level: number): string {
	if (level === 1) return 'full';
	if (level === 2) return 'large';
	if (level === 3) return 'medium';
	return 'small';
}

function presetSpans(size: string, columns: number): { cols: number; rows: number } {
	const clamp = (n: number) => Math.max(1, Math.min(columns, Math.round(n)));
	switch (size) {
		case 'full':
			return { cols: columns, rows: 1 };
		case 'large':
			return { cols: clamp((columns * 2) / 3), rows: 2 };
		case 'medium':
			return { cols: clamp(columns / 2), rows: 1 };
		case 'small':
		default:
			return { cols: clamp(columns / 3), rows: 1 };
	}
}

function parseLevels(spec: string): { cols: number; rows: number }[] {
	const rungs: { cols: number; rows: number }[] = [];
	for (const raw of spec.split(',')) {
		const entry = raw.trim();
		if (!entry) continue;
		const m = entry.match(/^(\d+)(?:x(\d+))?$/i);
		if (!m) {
			console.warn(
				`[bento] Ignoring malformed levels rung "${entry}" — expected a column count like "4" or a footprint like "4x2".`,
			);
			continue;
		}
		rungs.push({ cols: parseInt(m[1], 10), rows: m[2] ? parseInt(m[2], 10) : 1 });
	}
	return rungs;
}

function convertHeadings(
	nodes: Node[],
	columns: number,
	ladder: { cols: number; rows: number }[] | null,
	gridPos?: string,
	gridFrame?: Record<string, string>,
): Node[] {
	const preamble: Node[] = [];
	const cells: Node[] = [];

	let currentHeading: Node | null = null;
	let currentChildren: Node[] = [];
	let seenFirstCellHeading = false;

	const flush = () => {
		if (!currentHeading) return;
		const level = (currentHeading.attributes?.level as number) ?? 2;
		const cellChildren = [currentHeading, ...currentChildren];
		const posAttr = { ...(gridPos ? { 'media-position': gridPos } : {}), ...(gridFrame ?? {}) };
		if (ladder && ladder.length > 0) {
			const rungIndex = Math.max(0, level - 1);
			const { cols, rows } = ladder[Math.min(rungIndex, ladder.length - 1)];
			cells.push(
				new Ast.Node('tag', { size: '', cols, rows, ...posAttr }, cellChildren, 'bento-cell'),
			);
		} else {
			const size = tieredSize(level);
			const { cols, rows } = presetSpans(size, columns);
			cells.push(new Ast.Node('tag', { size, cols, rows, ...posAttr }, cellChildren, 'bento-cell'));
		}
	};

	for (const node of nodes) {
		if (node.type === 'heading') {
			seenFirstCellHeading = true;
			flush();
			currentHeading = node;
			currentChildren = [];
		} else if (!seenFirstCellHeading) {
			preamble.push(node);
		} else {
			currentChildren.push(node);
		}
	}
	flush();

	return [...preamble, ...cells];
}

export { presetSpans };

export const bento = createContentModelSchema({
	attributes: {
		gap: {
			type: String,
			required: false,
			description: 'Space between grid cells (CSS length value)',
		},
		columns: {
			type: Number,
			required: false,
			description: 'Number of columns in the bento grid (default 6)',
		},
		levels: {
			type: String,
			required: false,
			description:
				'Heading-sugar footprint ladder, indexed by absolute heading level (rung 0 = h1, rung 1 = h2, …): comma-separated rungs, each a column count "W" (× 1 row) or a footprint "WxH" (e.g. "6,5,4,3,2,1" or "4x2,3x1,2x1"). Depths beyond the last rung clamp to it. Omit for tiered sizing. Ignored for explicit-cell grids.',
		},
		'row-height': {
			type: String,
			required: false,
			matches: ['sm', 'md', 'lg', 'xl'],
			description: 'Uniform grid row track height: sm, md (default), lg, or xl',
		},
		'content-height': {
			type: String,
			required: false,
			matches: ['sm', 'md', 'lg', 'xl'],
			description:
				"Grid default: pin each column cell's text area to a fixed height (sm/md/lg/xl) so cells align vertically; per-cell overridable; reverts to natural height on mobile",
		},
		'media-ratio': {
			type: String,
			required: false,
			matches: ['1/3', '2/5', '1/2', '3/5', '2/3'],
			description:
				"Grid default for beside (start/end) cells: the media zone's share of the cell width; per-cell overridable",
		},
		'media-position': {
			type: String,
			required: false,
			matches: ['top', 'bottom', 'start', 'end', 'cover'],
			description:
				"Grid default media placement for every cell (overrides the per-cell size-derived default); a cell's own media-position still wins",
		},
		collapse: {
			type: String,
			required: false,
			matches: ['sm', 'md', 'lg', 'never'],
			description:
				'Binary collapse breakpoint: above it the grid renders as authored, below it cells stack into a single column with auto row tracks. Default sm (640px). `never` to disable.',
		},
	},
	contentModel: (attrs) => ({
		type: 'custom' as const,
		processChildren: (nodes: unknown[]) => {
			const ns = nodes as Node[];
			const gridPos = attrs['media-position'] as string | undefined;
			const GRID_CASCADE = [
				'frame',
				'frame-aspect',
				'frame-displace',
				'frame-offset',
				'frame-oversize',
				'frame-place',
				'frame-anchor',
				'frame-shadow',
				'elevation',
			];
			const gridFrame: Record<string, string> = {};
			for (const k of GRID_CASCADE) {
				const v = attrs[k];
				if (v != null && v !== '') gridFrame[k] = String(v);
			}
			const stripGridFrame = () => {
				for (const k of GRID_CASCADE) delete (attrs as Record<string, unknown>)[k];
			};
			const hasExplicit = ns.some((n) => n.type === 'tag' && (n as any).tag === 'bento-cell');
			if (hasExplicit) {
				const cells = ns.filter((n) => n.type === 'tag' && (n as any).tag === 'bento-cell');
				for (const cell of cells) {
					if (gridPos && cell.attributes?.['media-position'] === undefined) {
						cell.attributes = { ...cell.attributes, 'media-position': gridPos };
					}
					for (const [k, v] of Object.entries(gridFrame)) {
						if (cell.attributes?.[k] === undefined)
							cell.attributes = { ...cell.attributes, [k]: v };
					}
				}
				stripGridFrame();
				return cells;
			}
			const ladder = attrs.levels ? parseLevels(attrs.levels as string) : null;
			const cells = convertHeadings(ns, (attrs.columns as number) ?? 6, ladder, gridPos, gridFrame);
			stripGridFrame();
			return cells;
		},
		description:
			'A grid of cells. Heading sugar (each heading → a cell, tile size from depth) OR explicit {% bento-cell %} cells (full control). A grid primitive — no page-section preamble.',
	}),
	transform(resolved, attrs, config) {
		const allChildren = asNodes(resolved.children);

		const leadAst: Node[] = [];
		const cellAst: Node[] = [];
		for (const child of allChildren) {
			if (child.type === 'tag' && (child as any).tag === 'bento-cell') cellAst.push(child);
			else leadAst.push(child);
		}

		const lead = new RenderableNodeCursor(
			Markdoc.transform(leadAst, config) as RenderableTreeNode[],
		);
		const cellStream = new RenderableNodeCursor(
			Markdoc.transform(cellAst, config) as RenderableTreeNode[],
		);

		const columns = (attrs.columns as number) ?? 6;
		const gapMeta = new Tag('meta', { content: (attrs.gap as string) ?? '1rem' });
		const columnsMeta = new Tag('meta', { content: String(columns) });
		const rowHeightMeta = new Tag('meta', { content: (attrs['row-height'] as string) ?? '' });
		const contentHeightMeta = new Tag('meta', {
			content: (attrs['content-height'] as string) ?? '',
		});
		const mediaRatioMeta = new Tag('meta', { content: (attrs['media-ratio'] as string) ?? '' });
		const collapseMeta = new Tag('meta', { content: (attrs.collapse as string) ?? '' });

		const cells = cellStream.tag('div').typeof('BentoCell');
		const grid = cells.wrap('div');

		const children: RenderableTreeNode[] = [];
		if (lead.count() > 0) children.push(...(lead.toArray() as RenderableTreeNode[]));
		children.push(grid.next());

		return createComponentRenderable({
			rune: 'bento',
			tag: 'section',
			properties: {
				gap: gapMeta,
				columns: columnsMeta,
				'row-height': rowHeightMeta,
				'content-height': contentHeightMeta,
				'media-ratio': mediaRatioMeta,
				collapse: collapseMeta,
				cell: cells,
			},
			refs: { grid },
			children,
		});
	},
});

View plugins/marketing/src/tags/bento.ts on GitHub

A magazine-style grid of tiles in different sizes. Write a heading for each cell and its level sets the tile's size, or write {% bento-cell %} tags to size each tile exactly. A bento has no headline of its own; to title a grid, wrap it in a feature or section.

Basic usage

Each heading starts a cell. Its level sets the tile's size, whatever else is in the grid, so ### is always a medium tile.

{% bento columns=6 %}
## Featured Article

This cell spans two-thirds of the grid across two rows — the hero of the layout.

#### Tip of the Day

A small cell — a third of the grid width — sits beside the hero.

#### Did You Know?

Another small cell tucks under the first, still beside the hero.

### Quick Update

A medium cell, half the grid width.

### Latest News

Another medium pairs alongside.
{% /bento %}
<section data-rune="bento" data-rune-fields="{&quot;gap&quot;:&quot;1rem&quot;,&quot;columns&quot;:&quot;6&quot;,&quot;row-height&quot;:&quot;&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;,&quot;collapse&quot;:&quot;&quot;}">
  <div data-name="grid">
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;large&quot;,&quot;cols&quot;:&quot;4&quot;,&quot;rows&quot;:&quot;2&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="start" data-field="cell">
      <h3 id="featured-article" data-name="title">Featured Article</h3>
      <div data-name="body">
        <p>This cell spans two-thirds of the grid across two rows — the hero of the layout.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;small&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="tip-of-the-day" data-name="title">Tip of the Day</h3>
      <div data-name="body">
        <p>A small cell — a third of the grid width — sits beside the hero.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;small&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="did-you-know" data-name="title">Did You Know?</h3>
      <div data-name="body">
        <p>Another small cell tucks under the first, still beside the hero.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;medium&quot;,&quot;cols&quot;:&quot;3&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="quick-update" data-name="title">Quick Update</h3>
      <div data-name="body">
        <p>A medium cell, half the grid width.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;medium&quot;,&quot;cols&quot;:&quot;3&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="latest-news" data-name="title">Latest News</h3>
      <div data-name="body">
        <p>Another medium pairs alongside.</p>
      </div>
    </div>
  </div>
</section>

Featured Article

This cell spans two-thirds of the grid across two rows — the hero of the layout.

Tip of the Day

A small cell — a third of the grid width — sits beside the hero.

Did You Know?

Another small cell tucks under the first, still beside the hero.

Quick Update

A medium cell, half the grid width.

Latest News

Another medium pairs alongside.

<section class="rf-bento" data-columns="6" data-gap="1rem" data-row-height="" data-content-height="" data-media-ratio="" data-collapse="" data-elevation="flush" data-rune="bento" data-density="full" style="--bento-columns: 6; --bento-gap: 1rem">
  <div data-name="grid" class="rf-bento__grid">
    <div class="rf-bento-cell" data-media-position="start" data-field="cell" data-size="large" data-cols="4" data-rows="2" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 4; --cell-rows: 2">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="featured-article" data-name="title" class="rf-bento-cell__title" data-section="title">Featured Article</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>This cell spans two-thirds of the grid across two rows — the hero of the layout.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="small" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="tip-of-the-day" data-name="title" class="rf-bento-cell__title" data-section="title">Tip of the Day</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>A small cell — a third of the grid width — sits beside the hero.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="small" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="did-you-know" data-name="title" class="rf-bento-cell__title" data-section="title">Did You Know?</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Another small cell tucks under the first, still beside the hero.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="medium" data-cols="3" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 3; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="quick-update" data-name="title" class="rf-bento-cell__title" data-section="title">Quick Update</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>A medium cell, half the grid width.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="medium" data-cols="3" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 3; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="latest-news" data-name="title" class="rf-bento-cell__title" data-section="title">Latest News</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Another medium pairs alongside.</p>
        </div>
      </div>
    </div>
  </div>
</section>

How Markdown is read

You writeIt becomes
A headingA cell, titled with the heading; # makes a full tile, ## large, ### medium, #### and deeper small
The content under a heading, up to the nextThe cell's body
--- inside a cellSplits it into media and body; with two, the last part is a footer (Add media to cells)
Content before the first headingLoose content above the grid

Size cells by heading level

The grid has 6 columns by default, and each size keeps its proportion at any columns:

HeadingSizeFootprint at 6 columns
#fullfull width, 1 row
##largetwo-thirds width, 2 rows
###mediumhalf width, 1 row
#### and deepersmalla third of the width, 1 row

Every row has the same height, so a large cell is twice as tall as its neighbors. Set that height with row-height (sm, md, lg or xl).

Set your own sizes

levels replaces the sizes above with your own, one per heading level starting at #. Each entry is a column count (one row tall) or a WxH footprint:

{% bento columns=6 levels="6,3,2" collapse="sm" %}
# Launch

`#` takes the first entry — the full width.

## Metrics

`##` takes the second — half the width, so it pairs with the next.

## Activity

Half-width.

### Alpha

`###` takes the third — a third of the width.

### Beta

A third.

### Gamma

A third.
{% /bento %}
<section data-rune="bento" data-rune-fields="{&quot;gap&quot;:&quot;1rem&quot;,&quot;columns&quot;:&quot;6&quot;,&quot;row-height&quot;:&quot;&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;,&quot;collapse&quot;:&quot;sm&quot;}">
  <div data-name="grid">
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;6&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="launch" data-name="title">Launch</h3>
      <div data-name="body">
        <p>
          <code>#</code>
          takes the first entry — the full width.
        </p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;3&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="metrics" data-name="title">Metrics</h3>
      <div data-name="body">
        <p>
          <code>##</code>
          takes the second — half the width, so it pairs with the next.
        </p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;3&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="activity" data-name="title">Activity</h3>
      <div data-name="body">
        <p>Half-width.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="alpha" data-name="title">Alpha</h3>
      <div data-name="body">
        <p>
          <code>###</code>
          takes the third — a third of the width.
        </p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="beta" data-name="title">Beta</h3>
      <div data-name="body">
        <p>A third.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="gamma" data-name="title">Gamma</h3>
      <div data-name="body">
        <p>A third.</p>
      </div>
    </div>
  </div>
</section>

Launch

# takes the first entry — the full width.

Metrics

## takes the second — half the width, so it pairs with the next.

Activity

Half-width.

Alpha

### takes the third — a third of the width.

Beta

A third.

Gamma

A third.

<section class="rf-bento" data-columns="6" data-gap="1rem" data-row-height="" data-content-height="" data-media-ratio="" data-collapse="sm" data-elevation="flush" data-rune="bento" data-density="full" style="--bento-columns: 6; --bento-gap: 1rem">
  <div data-name="grid" class="rf-bento__grid">
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="" data-cols="6" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 6; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="launch" data-name="title" class="rf-bento-cell__title" data-section="title">Launch</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>
            <code>#</code>
             takes the first entry — the full width.
          </p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="" data-cols="3" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 3; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="metrics" data-name="title" class="rf-bento-cell__title" data-section="title">Metrics</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>
            <code>##</code>
             takes the second — half the width, so it pairs with the next.
          </p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="" data-cols="3" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 3; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="activity" data-name="title" class="rf-bento-cell__title" data-section="title">Activity</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Half-width.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="alpha" data-name="title" class="rf-bento-cell__title" data-section="title">Alpha</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>
            <code>###</code>
             takes the third — a third of the width.
          </p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="beta" data-name="title" class="rf-bento-cell__title" data-section="title">Beta</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>A third.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="gamma" data-name="title" class="rf-bento-cell__title" data-section="title">Gamma</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>A third.</p>
        </div>
      </div>
    </div>
  </div>
</section>
  • Headings deeper than the list use its last entry, so write only as many entries as you have sizes.
  • Entries are column counts, not proportions: change columns and you need to revisit them.
  • levels="6,5,4,3,2,1" keeps every cell one row tall with width following the heading; levels="6x1,6x2,6x3" makes full-width cells that grow taller, for a timeline feel.

Add media to cells

Split a cell on --- into media, body and an optional footer, as on card. Large and full cells put the media beside the body; smaller cells stack it on top. Set media-position on the bento to change every cell at once, and on a bento-cell to change one. elevation works the same way: set it on the bento to lift every cell.

{% bento columns=6 elevation="raised" %}
# Coral reef

![A coral reef teeming with life](https://assets.refrakt.md/figure-coral-reef.jpg)

---

Teeming with life beneath turquoise waters — the image fills the cell's media zone.

# Hot springs

![Volcanic hot springs](https://assets.refrakt.md/figure-hot-springs.jpg)

---

Steam rising from the Icelandic highlands.
{% /bento %}
<section data-rune="bento" data-rune-fields="{&quot;gap&quot;:&quot;1rem&quot;,&quot;columns&quot;:&quot;6&quot;,&quot;row-height&quot;:&quot;&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;,&quot;collapse&quot;:&quot;&quot;}">
  <div data-name="grid">
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;full&quot;,&quot;cols&quot;:&quot;6&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="start" elevation="raised" data-field="cell">
      <div data-section="media" data-name="media">
        <img src="https://assets.refrakt.md/figure-coral-reef.jpg" alt="A coral reef teeming with life">
      </div>
      <h3 id="coral-reef" data-name="title">Coral reef</h3>
      <div data-name="body">
        <p>Teeming with life beneath turquoise waters — the image fills the cell's media zone.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;full&quot;,&quot;cols&quot;:&quot;6&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="start" elevation="raised" data-field="cell">
      <div data-section="media" data-name="media">
        <img src="https://assets.refrakt.md/figure-hot-springs.jpg" alt="Volcanic hot springs">
      </div>
      <h3 id="hot-springs" data-name="title">Hot springs</h3>
      <div data-name="body">
        <p>Steam rising from the Icelandic highlands.</p>
      </div>
    </div>
  </div>
</section>
A coral reef teeming with life

Coral reef

Teeming with life beneath turquoise waters — the image fills the cell's media zone.

Volcanic hot springs

Hot springs

Steam rising from the Icelandic highlands.

<section class="rf-bento" data-columns="6" data-gap="1rem" data-row-height="" data-content-height="" data-media-ratio="" data-collapse="" data-elevation="flush" data-rune="bento" data-density="full" style="--bento-columns: 6; --bento-gap: 1rem">
  <div data-name="grid" class="rf-bento__grid">
    <div class="rf-bento-cell" data-media-position="start" data-field="cell" data-size="full" data-cols="6" data-rows="1" data-content-height="" data-media-ratio="" data-elevation="raised" data-rune="bento-cell" data-density="compact" style="--cell-cols: 6; --cell-rows: 1">
      <div data-section="media" data-name="media" class="rf-bento-cell__media" data-guest-fit="clip">
        <img src="https://assets.refrakt.md/figure-coral-reef.jpg" alt="A coral reef teeming with life" />
      </div>
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="coral-reef" data-name="title" class="rf-bento-cell__title" data-section="title">Coral reef</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Teeming with life beneath turquoise waters — the image fills the cell's media zone.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="start" data-field="cell" data-size="full" data-cols="6" data-rows="1" data-content-height="" data-media-ratio="" data-elevation="raised" data-rune="bento-cell" data-density="compact" style="--cell-cols: 6; --cell-rows: 1">
      <div data-section="media" data-name="media" class="rf-bento-cell__media" data-guest-fit="clip">
        <img src="https://assets.refrakt.md/figure-hot-springs.jpg" alt="Volcanic hot springs" />
      </div>
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="hot-springs" data-name="title" class="rf-bento-cell__title" data-section="title">Hot springs</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Steam rising from the Icelandic highlands.</p>
        </div>
      </div>
    </div>
  </div>
</section>

Any visual rune works as cell media; see Media guests. In a cell with href, an interactive guest such as a codegroup or map shows its static form so the whole cell stays one link, and the build warns. The frame-* attributes go on a bento-cell, not on the bento.

Line up text across cells

content-height (sm to xl) gives the text of every stacked cell the same height, so captions line up however long they are; the media takes the rest of the row. For cells with the media beside the text, media-ratio sets the media's share of the width instead. Set either on the bento for the whole grid, or on a bento-cell for one; both relax once the grid stacks.

{% bento columns=4 levels="2" row-height="lg" content-height="md" media-position="bottom" collapse="sm" %}
### Coral reef

![A coral reef teeming with life](https://assets.refrakt.md/figure-coral-reef.jpg)

---

Teeming with life beneath turquoise waters.

### Hot springs

![Volcanic hot springs](https://assets.refrakt.md/figure-hot-springs.jpg)

---

Steam rising from the Icelandic highlands, where geothermal vents warm the rivers and pools all year round.
{% /bento %}
<section data-rune="bento" data-rune-fields="{&quot;gap&quot;:&quot;1rem&quot;,&quot;columns&quot;:&quot;4&quot;,&quot;row-height&quot;:&quot;lg&quot;,&quot;content-height&quot;:&quot;md&quot;,&quot;media-ratio&quot;:&quot;&quot;,&quot;collapse&quot;:&quot;sm&quot;}">
  <div data-name="grid">
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="bottom" data-field="cell">
      <div data-section="media" data-name="media">
        <img src="https://assets.refrakt.md/figure-coral-reef.jpg" alt="A coral reef teeming with life">
      </div>
      <h3 id="coral-reef" data-name="title">Coral reef</h3>
      <div data-name="body">
        <p>Teeming with life beneath turquoise waters.</p>
      </div>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="bottom" data-field="cell">
      <div data-section="media" data-name="media">
        <img src="https://assets.refrakt.md/figure-hot-springs.jpg" alt="Volcanic hot springs">
      </div>
      <h3 id="hot-springs" data-name="title">Hot springs</h3>
      <div data-name="body">
        <p>Steam rising from the Icelandic highlands, where geothermal vents warm the rivers and pools all year round.</p>
      </div>
    </div>
  </div>
</section>
A coral reef teeming with life

Coral reef

Teeming with life beneath turquoise waters.

Volcanic hot springs

Hot springs

Steam rising from the Icelandic highlands, where geothermal vents warm the rivers and pools all year round.

<section class="rf-bento" data-columns="4" data-gap="1rem" data-row-height="lg" data-content-height="md" data-media-ratio="" data-collapse="sm" data-elevation="flush" data-rune="bento" data-density="full" style="--bento-columns: 4; --bento-gap: 1rem">
  <div data-name="grid" class="rf-bento__grid">
    <div class="rf-bento-cell" data-media-position="bottom" data-field="cell" data-size="" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-section="media" data-name="media" class="rf-bento-cell__media" data-guest-fit="clip">
        <img src="https://assets.refrakt.md/figure-coral-reef.jpg" alt="A coral reef teeming with life" />
      </div>
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="coral-reef" data-name="title" class="rf-bento-cell__title" data-section="title">Coral reef</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Teeming with life beneath turquoise waters.</p>
        </div>
      </div>
    </div>
    <div class="rf-bento-cell" data-media-position="bottom" data-field="cell" data-size="" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-section="media" data-name="media" class="rf-bento-cell__media" data-guest-fit="clip">
        <img src="https://assets.refrakt.md/figure-hot-springs.jpg" alt="Volcanic hot springs" />
      </div>
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="hot-springs" data-name="title" class="rf-bento-cell__title" data-section="title">Hot springs</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>Steam rising from the Icelandic highlands, where geothermal vents warm the rivers and pools all year round.</p>
        </div>
      </div>
    </div>
  </div>
</section>

Size each cell yourself

For a dashboard, write {% bento-cell %} tags and give each one exact cols and rows, or a size preset. A cell takes its own media-position, tint, and an href that makes the whole tile a link. Once a bento holds a bento-cell, loose headings are ignored, so don't mix the two.

{% bento columns=6 %}
	{% bento-cell cols=4 rows=2 href="/runes/rune-catalog" %}
	## Overview

	The hero tile spans four columns and two rows, and the whole cell links out.
	{% /bento-cell %}

	{% bento-cell cols=2 media-position="end" %}
	## Sidebar

	A two-column companion tile.
	{% /bento-cell %}
{% /bento %}
<section data-rune="bento" data-rune-fields="{&quot;gap&quot;:&quot;1rem&quot;,&quot;columns&quot;:&quot;6&quot;,&quot;row-height&quot;:&quot;&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;,&quot;collapse&quot;:&quot;&quot;}">
  <div data-name="grid">
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;medium&quot;,&quot;cols&quot;:&quot;4&quot;,&quot;rows&quot;:&quot;2&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="top" data-field="cell">
      <h3 id="overview" data-name="title">Overview</h3>
      <div data-name="body">
        <p>The hero tile spans four columns and two rows, and the whole cell links out.</p>
      </div>
      <a data-name="link" href="/runes/rune-catalog" data-link="stretch"></a>
    </div>
    <div data-rune="bento-cell" data-rune-fields="{&quot;size&quot;:&quot;medium&quot;,&quot;cols&quot;:&quot;2&quot;,&quot;rows&quot;:&quot;1&quot;,&quot;content-height&quot;:&quot;&quot;,&quot;media-ratio&quot;:&quot;&quot;}" data-media-position="end" data-field="cell">
      <h3 id="sidebar" data-name="title">Sidebar</h3>
      <div data-name="body">
        <p>A two-column companion tile.</p>
      </div>
    </div>
  </div>
</section>

Overview

The hero tile spans four columns and two rows, and the whole cell links out.

A two-column companion tile.

<section class="rf-bento" data-columns="6" data-gap="1rem" data-row-height="" data-content-height="" data-media-ratio="" data-collapse="" data-elevation="flush" data-rune="bento" data-density="full" style="--bento-columns: 6; --bento-gap: 1rem">
  <div data-name="grid" class="rf-bento__grid">
    <div class="rf-bento-cell" data-media-position="top" data-field="cell" data-size="medium" data-cols="4" data-rows="2" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 4; --cell-rows: 2">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="overview" data-name="title" class="rf-bento-cell__title" data-section="title">Overview</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>The hero tile spans four columns and two rows, and the whole cell links out.</p>
        </div>
      </div>
      <a data-name="link" href="/runes/rune-catalog" data-link="stretch" class="rf-bento-cell__link"></a>
    </div>
    <div class="rf-bento-cell" data-media-position="end" data-field="cell" data-size="medium" data-cols="2" data-rows="1" data-content-height="" data-media-ratio="" data-rune="bento-cell" data-density="compact" style="--cell-cols: 2; --cell-rows: 1">
      <div data-name="content" class="rf-bento-cell__content">
        <h3 id="sidebar" data-name="title" class="rf-bento-cell__title" data-section="title">Sidebar</h3>
        <div data-name="body" class="rf-bento-cell__body" data-section="body">
          <p>A two-column companion tile.</p>
        </div>
      </div>
    </div>
  </div>
</section>

Choose when the grid stacks

Above the collapse width the grid renders exactly as written; below it, the cells stack in a single column and size to their content. There is no step in between.

collapseStacks below
sm (default)640px
md768px
lg1024px
nevernever stacks

Pick the narrowest width your grid holds comfortably: a 6-column grid with wide cells wants md or lg, a grid of small cells can stay at sm. The width is the grid's own container, not the window.

Attributes

AttributeTypeRequiredDescription
gapstring—Space between grid cells (CSS length value)
columnsnumber—Number of columns in the bento grid (default 6)
levelsstring—Heading-sugar footprint ladder, indexed by absolute heading level (rung 0 = h1, rung 1 = h2, …): comma-separated rungs, each a column count "W" (× 1 row) or a footprint "WxH" (e.g. "6,5,4,3,2,1" or "4x2,3x1,2x1"). Depths beyond the last rung clamp to it. Omit for tiered sizing. Ignored for explicit-cell grids.
row-height"sm" | "md" | "lg" | "xl"—Uniform grid row track height: sm, md (default), lg, or xl
content-height"sm" | "md" | "lg" | "xl"—Grid default: pin each column cell's text area to a fixed height (sm/md/lg/xl) so cells align vertically; per-cell overridable; reverts to natural height on mobile
media-ratio"1/3" | "2/5" | "1/2" | "3/5" | "2/3"—Grid default for beside (start/end) cells: the media zone's share of the cell width; per-cell overridable
media-position"top" | "bottom" | "start" | "end" | "cover"—Grid default media placement for every cell (overrides the per-cell size-derived default); a cell's own media-position still wins
collapse"sm" | "md" | "lg" | "never"—Binary collapse breakpoint: above it the grid renders as authored, below it cells stack into a single column with auto row tracks. Default sm (640px). `never` to disable.

Universal attributes

bg

The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.

AttributeTypeRequiredDescription
bgstring—Background preset applied to this block
bg-fromstring—Gradient start colour — a semantic token name (→ var(--rf-color-*))
bg-gradient"to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl"—Gradient direction (bounded named set)
bg-gradient-type"linear" | "radial" | "conic"—Gradient type
bg-tostring—Gradient end colour — a semantic token name
bg-viastring—Optional middle gradient stop — a semantic token name
scrim"top" | "bottom" | "left" | "right" | "none"—Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim
scrim-blur"none" | "sm" | "md" | "lg"—Frost scrim blur amount
scrim-strength"sm" | "md" | "lg"—Gradient scrim strength
scrim-tone"dark" | "light"—Whether the scrim darkens (for light text) or lightens (for dark text)
scrim-type"gradient" | "frost"—Scrim treatment: gradient (default) or frost (backdrop blur)
elevation

How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.

AttributeTypeRequiredDescription
elevation"sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg"—Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating)
inset

Internal padding override.

AttributeTypeRequiredDescription
inset"flush" | "tight" | "default" | "loose" | "breathe"—Inner padding of this block
motion

Scroll-reveal entrance. You choose its character; the theme decides how it moves.

AttributeTypeRequiredDescription
reveal"none" | "fade" | "slide" | "scale" | "blur"—Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography
staggerboolean—Cascade this block's items in as it reveals (no-op on single-child runes)
spacing

Block-level rhythm override.

AttributeTypeRequiredDescription
spacing"flush" | "tight" | "default" | "loose" | "breathe"—Vertical spacing above and below this block
substrate

Generated pattern fills behind the content, drawn by the theme.

AttributeTypeRequiredDescription
substrate"dots" | "grid" | "lines" | "cross" | "checker" | "none"—Generated surface pattern
substrate-fill"inherit" | "inset"—Surface fill the pattern sits on (full colour stays with tint)
substrate-opacity"sm" | "md" | "lg"—Pattern ink strength
substrate-size"sm" | "md" | "lg"—Pattern cell size
substrate-target"self" | "media"—Which surface the pattern fills (overrides the rune/theme default)
tint

Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.

AttributeTypeRequiredDescription
tintstring—Color tint preset applied to this block
tint-mode"auto" | "dark" | "light"—Whether the tint adapts to auto, dark, or light mode
width

The track a block rune occupies.

AttributeTypeRequiredDescription
width"compact" | "narrow" | "content" | "wide" | "full"—Maximum width constraint for this block
Not availableWhy
dropcap, readingthis rune declares no prose body
framethis rune declares neither a `frameTarget` nor a media section
prominencethis rune has no page-section header or featured quotation

bento-cell

AttributeTypeRequiredDescription
sizestring—
colsnumber—
rowsnumber—
media-position"top" | "bottom" | "start" | "end" | "cover"—
content-height"sm" | "md" | "lg" | "xl"—Override the grid content-height for this cell (column cells): pin its text area to sm/md/lg/xl
media-ratio"1/3" | "2/5" | "1/2" | "3/5" | "2/3"—Override the grid media-ratio for this cell (beside cells): the media zone's share of the cell width
hrefstring—

Universal attributes

bg

The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.

AttributeTypeRequiredDescription
bgstring—Background preset applied to this block
bg-fromstring—Gradient start colour — a semantic token name (→ var(--rf-color-*))
bg-gradient"to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl"—Gradient direction (bounded named set)
bg-gradient-type"linear" | "radial" | "conic"—Gradient type
bg-tostring—Gradient end colour — a semantic token name
bg-viastring—Optional middle gradient stop — a semantic token name
scrim"top" | "bottom" | "left" | "right" | "none"—Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim
scrim-blur"none" | "sm" | "md" | "lg"—Frost scrim blur amount
scrim-strength"sm" | "md" | "lg"—Gradient scrim strength
scrim-tone"dark" | "light"—Whether the scrim darkens (for light text) or lightens (for dark text)
scrim-type"gradient" | "frost"—Scrim treatment: gradient (default) or frost (backdrop blur)
dropcap

Per-instance drop-cap opt-in.

AttributeTypeRequiredDescription
dropcapboolean—Style the opening letter of a prose body as a drop cap. Honoured only when the body reads as prose; ignored otherwise.
elevation

How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.

AttributeTypeRequiredDescription
elevation"sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg"—Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating)
frame

Surface chrome: a named preset from the theme registry with inline `frame-*` overrides layered on top.

AttributeTypeRequiredDescription
framestring—Named frame preset presenting this block's media surface
frame-anchorstring—Crop focal point when the guest is cut (object-position)
frame-aspectstring—Aspect ratio of the framed media, e.g. "16/9"
frame-displace"top" | "bottom" | "end" | "bottom-end" | "top-end" | "both"—Edge/corner the framed guest moves toward
frame-displace-mode"peek" | "bleed"—How displacement renders: `peek` (default) translates the guest visually inside its frame target; `bleed` uses negative margin on the media zone so following layout pulls up — extends past a section like a hero without leaving a gap above
frame-offset"none" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl"—Displacement distance (non-linear named scale: sm…xl ride the block-spacing tokens, 2xl/3xl/4xl step up to section-spacing for bleed-mode displacements that clear a section edge)
frame-overflow"clip" | "bleed"—How the frame handles a guest whose content is wider than it: `clip` (default) keeps it inside the rounded frame; `bleed` runs an overflowing guest out to the layout edge on a narrow viewport so it reads as cropped by the screen (a bleed host only — hero/feature)
frame-oversizestring—How far the guest exceeds its slot (scale factor)
frame-placestring—Guest-box alignment in the slot (e.g. "left top")
frame-shadow"none" | "sm" | "md" | "lg"—Silhouette drop-shadow strength for the framed media
inset

Internal padding override.

AttributeTypeRequiredDescription
inset"flush" | "tight" | "default" | "loose" | "breathe"—Inner padding of this block
motion

Scroll-reveal entrance. You choose its character; the theme decides how it moves.

AttributeTypeRequiredDescription
reveal"none" | "fade" | "slide" | "scale" | "blur"—Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography
staggerboolean—Cascade this block's items in as it reveals (no-op on single-child runes)
prominence

Header emphasis. Scales a rune's header, or its featured quotation; the theme decides the type size for each step.

AttributeTypeRequiredDescription
prominence"quiet" | "normal" | "prominent" | "display" | "marquee"—Emphasis of a page-section header or a featured quotation (only on runes that have one)
reading

Editorial register for body text. You pick the register; the theme decides how it looks.

AttributeTypeRequiredDescription
reading"fine" | "ui" | "prose"—Reading register for this block’s body: fine | ui | prose. The theme sets how each one looks.
spacing

Block-level rhythm override.

AttributeTypeRequiredDescription
spacing"flush" | "tight" | "default" | "loose" | "breathe"—Vertical spacing above and below this block
substrate

Generated pattern fills behind the content, drawn by the theme.

AttributeTypeRequiredDescription
substrate"dots" | "grid" | "lines" | "cross" | "checker" | "none"—Generated surface pattern
substrate-fill"inherit" | "inset"—Surface fill the pattern sits on (full colour stays with tint)
substrate-opacity"sm" | "md" | "lg"—Pattern ink strength
substrate-size"sm" | "md" | "lg"—Pattern cell size
substrate-target"self" | "media"—Which surface the pattern fills (overrides the rune/theme default)
tint

Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.

AttributeTypeRequiredDescription
tintstring—Color tint preset applied to this block
tint-mode"auto" | "dark" | "light"—Whether the tint adapts to auto, dark, or light mode
width

The track a block rune occupies.

AttributeTypeRequiredDescription
width"compact" | "narrow" | "content" | "wide" | "full"—Maximum width constraint for this block