The Canvas editor with a Photo gallery list selected: the settings panel shows the number of items, the design, and under More options the layout, columns and gap.
The Canvas library with the Lists folder, where each View with a Canvas data display is an item: Latest news and Photo gallery.
The Photo gallery list on a page: six image cards with titles and dates, three per row.
A View with a Canvas data display: the Canvas data settings show the library name, the data keys, the designs and the grid.
The Data keys dialog: each field gets a key and an output type, with suggested keys and the designs that match them.
The Designs dialog: the designs editors may choose, the default design, and the lock.

This project is not covered by Drupal’s security advisory policy.

Use a View as the data source for Canvas components. A View picks the content; a component shows it.

How it works

  • Site builders add a "Canvas data" display to a View and give each field a key, such as title, image, url or date. Keys are suggested automatically.
  • Each display appears in the Canvas library under its own name.
  • Editors drag it into a page and choose the number of items, the design and the grid. No code.

Designs

  • Card designs are repeated once per row, in a CSS grid or a Bootstrap 5 grid, with columns for phones, tablets and desktops.
  • List designs, such as sliders, get all rows at once.
  • Any single-directory component or Canvas code component whose fields match the View's keys can be a design. Two designs are included: Data card and Data list.

Why not JSON:API?

The View runs on the server, so the data is in the page when it loads, with the View's access checks, language and cache tags. No JSON:API endpoint needs to be exposed, and it also works for single-directory components, which cannot fetch data.

Site builder controls

Per View: the allowed designs and layouts, the default design and grid, the most columns, and a lock that leaves editors only the number of items.

Requirements

  • Drupal 11.3 or later
  • Canvas 1.x

Installation

composer require drupal/canvas_views_data
drush en canvas_views_data

Project information

Releases