
Drupal Canvas 1.13 is the release where code components start to feel like first-class citizens. They can now link to other Canvas pages, take lists of content, speak the site’s language, and render on the server.
I didn’t want to write about it from the release notes alone. So I spun up a fresh Drupal site, installed Canvas 1.13, and built a small set of test components and pages that exercise each feature. This post walks through what I found, including the parts that still have rough edges. Where a feature landed in 1.11 or 1.12, I say so: if you are coming from an older Canvas, you get all of them at once.
The test bench
Everything below was tested on a clean DDEV site running Drupal 11.4 and Canvas 1.13.0 with the Mercury theme. I wrote a small custom module, canvas_playground, that ships 11 code components and a seed script that builds one test page per feature.
| Page | What it exercises | Since |
|---|---|---|
/pg |
Links to Canvas pages, lists of entity references | 1.13 |
/pg/i18n and /fr/pg/i18n |
useTranslation() and useDateFormatter() |
1.13 |
/pg/ssr |
Server-side rendering with canvas_ssr |
1.13 |
/pg/brand |
Brand Kit colors, SVG images, empty optional props | 1.12 |
/pg/documents |
Document props, per-page templates | 1.11 |
/pg/history |
Editable patterns, version history | 1.10 / 1.13 |
/articles/1, /media/<id> |
Content templates for nodes, media and block content | 1.13 |
Each component prints what it actually received (prop keys, raw values, the current language). That made it easy to see what Canvas passes to React, rather than guessing from the UI.
One layout system for the whole site
The biggest shift since 1.11 is that Canvas now lays out almost everything, not just landing pages. Three features work together here.
Page templates (1.11) replace the old “global regions”. A page template is a Canvas component tree for the header, footer and everything around the content. It holds exactly one Page content marker, where each page’s own content goes. Templates don’t depend on the theme, and each page can pick its own. In my sandbox, a “Landing” template without a footer sat next to the site default, and switching a page between them was one dropdown in its page data form.
Content templates for media and block content (1.13). Content templates already existed for nodes: one Canvas layout per bundle and view mode, with props wired to the entity’s fields. In 1.13 they work for any content entity type with configurable displays. My media.image.full template drove the detail page of an SVG logo, and a block_content.basic.full template rendered a reusable promo block. One layout system now covers content, media and blocks, instead of Twig for some types and Canvas for others.
Small editor improvements that add up (1.13):
- Component library folders are now visible to anyone who can see components, not just people with folder permissions.
- Modules can add their own operations to the Canvas content list, the Canvas equivalent of
hook_entity_operation(). Canvas only shows an operation if the user can access its URL.
#[Hook('canvas_content_operation')]
public function canvasContentOperation(EntityInterface $entity): array {
return [
'my_module_view_front' => [
'title' => new TranslatableMarkup('Open front end'),
'url' => $entity->toUrl(),
'weight' => 50,
],
];
}
If you upgrade a site that used global regions, drush updb converts each theme’s regions into a page template. Review the generated templates afterwards: they wrap a component that reproduces the theme’s page.html.twig.
Props that finally match real content
Four additions to component props remove workarounds that every Canvas project I’ve seen has had to invent.
| Feature | Since | The problem it solves |
|---|---|---|
| Link props can target Canvas pages | 1.13 | Links to Canvas pages were typed paths, and broke when an alias changed |
| Lists of content entity references | 1.13 | A component could reference only one entity |
| SVG in image props | 1.12 | Logos and icons had to be converted to PNG |
| Document props | 1.11 | No clean way to offer a PDF or DOCX from the media library |
Links to Canvas pages. A uri-reference prop now offers an autocomplete over Canvas pages, just like nodes. The value is stored as entity:canvas_page/17 and resolved to the current alias at render time. I renamed /pg/brand to /pg/brand-kit, reloaded, and the button followed.
Lists of entity references. A prop can now be an array of content-entity-reference. The component declares which fields it needs, and Canvas sends only those:
props:
articles:
type: array
items: { type: object, $ref: 'json-schema-definitions://canvas.module/content-entity-reference' }
dataDependencies:
entityFields:
articles:
- 'ℹ︎␜entity:node:article␝title␞␟value'
- 'ℹ︎␜entity:node:article␝created␞␟value'
- 'ℹ︎␜entity:node:article␝path␞␟alias'
Two surprises when consuming it in React: the title arrives as label, not title, and created is a Unix timestamp, not a date string. The release notes warn that referenced entity URLs are not reliable yet, but in my tests path and __url were both correct.
SVG images. Pick an SVG from the media library and the image prop accepts it as is. You still need to add svg to the allowed extensions of your image media field. Raster images get resized variants (alternateWidths); SVGs don’t need them.
Documents. A document prop receives { src, filename, filesize, mimetype, title?, description? } from a document media item. That’s enough to build a proper download link with the file type and size, without a custom field.
Code components that speak the site’s language
Until 1.13, a label hard-coded in a React component (“Read more”, “3 new messages”, a formatted date) stayed in English on every translation. The workarounds were a prop per string or reading drupalSettings by hand. Canvas 1.13 adds two hooks to drupal-canvas/react that plug code components into Drupal’s normal translation system.
import { useTranslation, useDateFormatter } from 'drupal-canvas/react';
const Greeting = ({ name, count = 0, date }) => {
const { t, formatPlural } = useTranslation();
const formatDate = useDateFormatter();
return (
<>
<h3>{t('Hello @name!', { '@name': name })}</h3>
<p>{formatPlural(count, 'You have 1 new message.', 'You have @count new messages.')}</p>
<time>{formatDate(date, { dateStyle: 'long' })}</time>
</>
);
};
I enabled French, translated the page, and translated the three strings in the standard interface translation screen. The same component rendered:
| Call | /pg/i18n |
/fr/pg/i18n |
|---|---|---|
t() |
Hello Akram! | Bonjour Akram ! |
formatPlural(), count 3 |
You have 3 new messages. | Vous avez 3 nouveaux messages. |
formatDate(), long style |
December 24, 2026 | 24 décembre 2026 |
Translators don’t need to know a component exists: the strings show up in Locale like any t() string. A few limits worth knowing before you rely on it:
- Only
@placeholders work.%and:are ignored, and the output is plain text, never HTML. - Canvas needs the list of strings a component uses (
translatableStringsin its config). The in-browser code editor and the CLI extract them from the source for you. If you create components another way, declare them yourself. - Dates are always formatted in UTC, because Canvas stores them without a time zone.
The one breaking change: empty optional props are now absent
Since 1.12, an optional object prop with no value is left out of the props entirely. Before, it could arrive as 0, '' or false. This is the change most likely to break existing code components when you upgrade.
I placed the same test component twice, once with its optional image and link empty and once filled:
| Instance | image |
link |
Prop keys received |
|---|---|---|---|
| Left empty | absent | absent | caption |
| Filled | { src, alt, width, height } |
https://drupal.org |
caption, image, link |
The new behavior is cleaner: “not set” has one meaning, undefined, and JavaScript default parameters finally work. But code written for the old values needs a pass:
// Works whether the prop is absent or set
const Card = ({ title, image, link = '#' }) => (
<div>
{image?.src && <img src={image.src} alt={image.alt ?? ''} />}
<a href={link}>{title}</a>
</div>
);
// Fragile: relied on the old empty values
if (image !== '' && image !== false) { /* ... */ }
Before upgrading, search your code components for comparisons with '', 0 or false on image, video, document and link props.
Guardrails for editors: patterns, Brand Kit and version history
Editable patterns (1.10). A pattern is a saved group of components that is inserted as a copy. Patterns can now be renamed and reopened in the editor, so fixing a typo no longer means rebuilding the pattern from scratch. Keep in mind that they are templates for copies, not linked instances: editing a pattern changes future insertions, not the copies already on pages.
Brand Kit (1.12). The Brand Kit is on by default and holds the site’s named colors and fonts. A color prop can be limited to Brand Kit colors (x-canvas-color-picker: kit-only), to some color folders (x-canvas-color-folders), or allow a free picker too. Components receive an object with colorName, cssVariable and cssColorValue. Use var(--your-variable) in styles, and a component follows the Brand Kit when a color changes.
Version history (1.13). Canvas pages keep revisions you can browse. One thing I got wrong at first: the history is not a panel in the editor. It lives on the page’s revisions screen, at /page/{id}/revisions, where you can open each earlier version. My test page had three revisions (a heading, then a paragraph, then a card grid), and each one rendered exactly as it was saved. It’s the kind of feature editors only notice the day something disappears, and then it saves them a call to a developer.
Server-side rendering with canvas_ssr
This is the headline feature for me. Until now, every code component was drawn in the browser: the page arrived with JSON props and an empty placeholder, then React filled it in. The new canvas_ssr submodule renders components on the server with Deno, so their HTML is in the response from the first byte.
What that buys you:
- Faster first paint. No empty block while React loads.
- Better SEO and link previews. Crawlers see the content in the HTML.
- Less JavaScript. A component that isn’t interactive ships no JS at all.
- A safe fallback. If SSR fails, the component renders in the browser as before.
The rule that decides all of this is the React Server Components convention, 'use client':
| Component | 'use client'? |
What the server sends | JS shipped |
|---|---|---|---|
| Static quote, site header, site footer | No | Final HTML | None |
| Click counter | Yes | HTML first (“Clicks: 0”), then React hydrates it | Yes |
On my test page, viewing the source showed the static quote with its server timestamp baked in. With JavaScript turned off, everything still displayed and only the counter stopped responding. With SSR on, the home page had no <canvas-island> placeholders left at all.
Setup is two steps: put a Deno binary at vendor/bin/deno (Canvas runs it with no permissions), then enable canvas_ssr. Two trade-offs to weigh before production:
- Each request that renders components starts a Deno process. Measure response times, and lean on Drupal’s page cache.
- Components that touch
windowordocumentwhile rendering can’t run on the server. Mark them'use client'and move that code intouseEffect.
The flip side: a component that uses state or event handlers must start with 'use client';. Forget it, and the server’s HTML is final: the button renders but never responds.
On the command line: doctor and component audit
Canvas ships two commands for dr, the new core CLI in Drupal 11.4 (not Drush):
canvas:doctorchecks all Canvas data: component trees, config and pending updates. Run it before and after an upgrade or a config import.canvas:component:audit(new in 1.13) lists every page, template, pattern and draft that uses a component. Run it before you change or delete one.
vendor/bin/dr canvas:doctor --checks=config,content,content_past_revisions --details
vendor/bin/dr canvas:component:audit js.my_hero
vendor/bin/dr canvas:component:audit sdc.mercury.card --revisions=latest
Both accept --format=json and exit with 0 (healthy), 1 (problems found) or 2 (invalid input), so they slot straight into CI. Auditing my hero component found its 4 uses: two pages, the article content template and a pattern. That’s exactly the list you want before a breaking prop change.
The doctor also earned its keep by finding a real bug. A code component prop with format: date or date-time makes Canvas generate a datetime field default with a value key, which core’s config schema rejects. Pages still render fine, but the config is invalid. If you use date props, expect this warning until it’s fixed upstream.
Should you upgrade?
Yes, especially if you write code components. Server-side rendering, translatable strings and richer props close the three gaps that most often pushed teams back to Twig. Content templates for media and blocks, and theme-independent page templates, mean one layout system can now cover the whole site.
Before you upgrade, check three things:
- Optional props. Search your components for comparisons with
'',0orfalseon object props. Those values are nowundefined. - Global regions. Review the page templates that
drush updbgenerates from them. - Date props. Expect a config warning from
canvas:doctoron components withdateordate-timeprops.
If you want to try it first, the fastest path is the one I took: a throwaway DDEV site, Canvas 1.13, and one small component per feature that prints what it receives. An afternoon is enough to see where Canvas stands today, and it’s a lot further along than it was a year ago.
If you’re new to Canvas, start with my introduction to Drupal Canvas, then why you should export your config after changing a component’s props.
