core
Bar
Block-level wrapper that renders a horizontal row of content — the bar layout primitive, composable in prose
Source
import Markdoc from '@markdoc/markdoc';
import type { RenderableTreeNode, Node } from '@markdoc/markdoc';
const { Tag } = Markdoc;
import { createContentModelSchema, bodyOnly, asNodes } from '../lib/index.js';
function splitBarZones(nodes: Node[]): { left: Node[]; right: Node[] } {
const hrIndex = nodes.findIndex((n) => n.type === 'hr');
if (hrIndex < 0) return { left: nodes, right: [] };
return {
left: nodes.slice(0, hrIndex),
right: nodes.slice(hrIndex + 1),
};
}
export const bar = createContentModelSchema({
attributes: {},
contentModel: bodyOnly(),
transform(resolved, _attrs, config) {
const zones = splitBarZones(asNodes(resolved.body));
const leftNodes = Markdoc.transform(zones.left, config) as RenderableTreeNode[];
const rightNodes = Markdoc.transform(zones.right, config) as RenderableTreeNode[];
const left = new Tag('div', {}, leftNodes);
const right =
zones.right.length > 0 ? new Tag('div', { 'data-align': 'end' }, rightNodes) : null;
const children: RenderableTreeNode[] = right ? [left, right] : [left];
return new Tag(
'div',
{
'data-rune': 'bar',
'data-zone-layout': 'bar',
},
children,
);
},
});
A bar is a horizontal row that flags context: an identifier on the left, a status badge on the right; a date and a category; a breadcrumb and an action.
A bar is position-agnostic geometry: place one in the eyebrow position (the slot above a title) for a kicker, or anywhere a labelled strip is wanted.
Basic usage
Split the body on a top-level --- to get two groups. The right group is pushed to the end of the row.
{% bar %}
WORK-051
---
{% badge sentiment="positive" %}done{% /badge %}
{% /bar %}<div data-rune="bar" data-zone-layout="bar">
<div>
<p>WORK-051</p>
</div>
<div data-align="end">
<p>
<span class="rf-badge" data-rune="badge" data-meta-sentiment="positive" data-meta-type="tag">done</span>
</p>
</div>
</div><div data-zone-layout="bar" class="rf-bar" data-rune="bar" data-density="full">
<div>
<p>WORK-051</p>
</div>
<div data-align="end">
<p>
<span class="rf-badge rf-badge" data-meta-sentiment="positive" data-meta-type="tag" data-rune="badge" data-density="full">done</span>
</p>
</div>
</div>How Markdown is read
| You write | It becomes |
|---|---|
Content before the first --- | The left group |
A ---, then more content | The right group, pushed to the end of the row |
No --- at all | A single left-aligned group |
Single group
Omit the --- to render a single left-aligned group.
{% bar %}
Updated 3 March 2026 · 4 min read
{% /bar %}<div data-rune="bar" data-zone-layout="bar">
<div>
<p>Updated 3 March 2026 · 4 min read</p>
</div>
</div><div data-zone-layout="bar" class="rf-bar" data-rune="bar" data-density="full">
<div>
<p>Updated 3 March 2026 · 4 min read</p>
</div>
</div>Composable inside other runes
Drop a bar inside any block rune that accepts authored content. The rune emits the same DOM regardless of where it appears, so themes that style [data-zone-layout="bar"] style every bar consistently.
{% card %}
{% bar %}
ID-123
---
{% badge sentiment="positive" %}New{% /badge %}
{% /bar %}
# Export workspace data
Download every project in a workspace as a single archive.
{% /card %}
Attributes
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.
| Attribute | Type | Required | Description |
|---|---|---|---|
bg | string | — | Background preset applied to this block |
bg-from | string | — | 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-to | string | — | Gradient end colour — a semantic token name |
bg-via | string | — | 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.
| Attribute | Type | Required | Description |
|---|---|---|---|
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.
| Attribute | Type | Required | Description |
|---|---|---|---|
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.
| Attribute | Type | Required | Description |
|---|---|---|---|
reveal | "none" | "fade" | "slide" | "scale" | "blur" | — | Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography |
stagger | boolean | — | Cascade this block's items in as it reveals (no-op on single-child runes) |
spacing
Block-level rhythm override.
| Attribute | Type | Required | Description |
|---|---|---|---|
spacing | "flush" | "tight" | "default" | "loose" | "breathe" | — | Vertical spacing above and below this block |
substrate
Generated pattern fills behind the content, drawn by the theme.
| Attribute | Type | Required | Description |
|---|---|---|---|
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.
| Attribute | Type | Required | Description |
|---|---|---|---|
tint | string | — | 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.
| Attribute | Type | Required | Description |
|---|---|---|---|
width | "compact" | "narrow" | "content" | "wide" | "full" | — | Maximum width constraint for this block |
| Not available | Why |
|---|---|
| dropcap, reading | this rune declares no prose body |
| frame | this rune declares neither a `frameTarget` nor a media section |
| prominence | this rune has no page-section header or featured quotation |
See also
{% badge %}— the chip primitive that pairs naturally with a bar's right group.{% deflist %}— sibling composable rune for thedefinition-listlayout primitive.