This project is not covered by Drupal’s security advisory policy.
Scrapbook adds a ready-made card and card grid to your Drupal site. Use them to show projects, articles or products as tidy, clickable cards with an image, text and tags, in any theme.
Many sites need a page of cards: a portfolio, a list of case studies, a product range, recent articles. Building one usually means writing your own template and CSS, and making it work in
your theme. Scrapbook gives you that card and grid already built, tested and accessible. They are
href="https://www.drupal.org/docs/develop/theming-drupal/using-single-director...">single directory components (SDC): reusable pieces of page design that Drupal core understands,
which your theme and other modules can use.
Features
- Card (
scrapbook:card): a title, an optional link (for example "View site →"), an image, a short description and tag badges. Any part can be left out, and
the image, text and tags can each be replaced with your own content, such as a responsive image or linked taxonomy terms. - Grid (
scrapbook:grid): lays cards out in up to 1–4 columns and drops columns automatically as space runs out. It responds to the space it is placed in, not
just the screen size, so it also works in sidebars and narrow regions. - Works with any theme: tested with Olivero and Claro. Its CSS only touches its own elements and never changes the rest of your page.
- Easy to restyle: colors, spacing, corners, shadows and the hover effect are CSS custom properties. Your theme can change them, or override any rule, without
!important. - Replaceable: a theme can swap in its own card markup using SDC's
replaces:key, and every card on the site follows. - Accessible: meets WCAG 2.2 AA color contrast, has visible keyboard focus, gives links a descriptive name for screen readers, announces links that open a new window, and
turns off motion for visitors who prefer reduced motion. - Ready for page builders: every prop has a full schema with examples, which visual tools such as Drupal Canvas use.
Use Scrapbook when you want a polished card layout quickly, without writing it yourself or tying it to one theme or CSS framework.
Post-Installation
There is no configuration page, content type or text format to set up. Enabling the module makes the two components available to Drupal. Nothing on your site changes until you use them.
To use them:
- In a Twig template, for example a node or Views template in your theme:
{{ include('scrapbook:card', { title: 'My project', url: '/node/1' }, with_context = false) }} - In PHP, as a render array:
['#type' => 'component', '#component' => 'scrapbook:card', '#props' => ['title' => 'My project']] - Without code, through a module that places components from the admin UI (see Recommended modules below).
The README lists every prop, slot and CSS custom property, with examples. The CSS loads automatically wherever a card or grid appears.
Additional Requirements
Drupal core 10.3 or later. No other modules or libraries.
Recommended modules/libraries
- Drupal Canvas, to place cards and grids visually in pages.
- UI Patterns, to use the components in Layout Builder, blocks, Views and field formatters without writing templates.
Similar projects
Many themes and theme frameworks include a card component, but it only works inside that theme or depends on its CSS framework. Scrapbook works under any theme, so you can switch themes and
keep your cards. Its zero-specificity CSS means your theme stays in control of the final look.
Supporting this Module
Bug reports, feature ideas and patches are welcome in the issue queue.
Community Documentation
- The module's README covers usage, theme overrides and all CSS custom properties.
- Using Single Directory Components (drupal.org documentation).
Coming next
Both components have a variant option. Only the clean default style exists today. A playful "scrapbook" variant, with tilted cards, tape and an uneven layout, is planned, and
it won't change existing markup.
Project information
- Project categories: Content display
- Created by jamestarleton on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
