Skip to content

Components of the base theme ​

The base theme ships a set of general components in components/, so every subtheme can build complete pages before it has a component of its own. They are Twig and CSS only (no React), take their colours from the theme, and each has a description, an icon and an example for the editor and the AI assistant.

The set ​

Layout ​

ComponentWhat it is forOptions
SectionA titled container: one part of a pageheading; plain or tinted
HeroThe opening of a page: big heading, short text and buttons over a picture or a colourpicture, shade (dark, light, none), height, text position; slot Actions
ContainerKeeps its content at a readable width, centrednarrow, normal, wide, full
ColumnsA grid with a number of columnsLayouts
FlexItems in a row or columnLayouts
StackItems under each other with an even gapLayouts
DividerA line between two partssolid, dashed, dotted; full, half, short; space
SpacerEmpty spaceheight from the spacing scale

Content ​

ComponentWhat it is forOptions
HeadingA heading on its own, with an optional line abovelevel H1–H4 (the outline), size (the look)
TextFormatted text, with the editor of a Drupal text format—
ImageAn image of the media libraryimage style, loading, link, caption
ButtonA link that looks like a buttonfilled, outline, text; size; colour of the palette; new tab
CardPicture, heading with an optional link, free contentslot Content
QuoteA testimonial or pull quote with its sourcename, role, portrait, size
Call to actionA highlighted band with heading, text and buttonsstacked or side by side; accent, soft, plain; slot Actions
Accordion + Accordion itemTitles that open to show content: FAQsboxes or lines; item: open at the start; slot Content
Number with a labelA big number or short fact: "8 people per class"—
BadgeA small label, to pin on a corner of a card or picturecolour, shape
NoticeA highlighted note: information, success, warning, errortitle, text

A typical landing page: Hero (with Buttons), a Section with Columns of Cards or Numbers, a Quote, an Accordion in a narrow Container, a Call to action.

Colours and tokens ​

The components use a few CSS custom properties, with neutral fallbacks:

PropertyUsed forDefault
--frame-accentbuttons, the filled call to action, numbers, the line of a quote, a short divider#1f4fd8
--frame-accent-contrasttext on the accent colour#fff
--frame-radiuscorners of buttons, boxes, hero0.375rem

With the builder module enabled, the tokens of your theme are on every page as custom properties, so the components pick up your colours without CSS: --frame-space-<name> and --frame-color-<name> for the spacing scale and the palette of the theme's .info.yml, and --frame-accent, which is the palette's colour named accent or primary, else its first colour. To choose otherwise, set them in your theme's CSS:

css
:root { --frame-accent: #b3261e; --frame-accent-contrast: #fff; --frame-radius: 0; }

A Button and a Badge also take a colour of the palette as a prop.

Making them yours ​

They are ordinary components:

  • Restyle them from your theme's CSS by their classes (.button-link, .hero, .cta, .quote, .accordion-item, .notice, .stat, .badge, .heading-block, .container-block, .divider, .spacer, .card, .section, .rich-text).
  • Replace one with your own version: a component in your theme with the same props and slots and replaces: frame:<name> in its *.component.yml. The builder then offers yours instead of the base theme's, and pages that used the base one show yours. The example subtheme does this for Card, Section and Text.
  • Hide what you do not want editors to use: replace it with a component that has noUi: true, or leave it and describe in its place what to use.

In the editor ​

  • An Accordion item is always open on the canvas, so its content can be edited; on the page it opens as set.
  • Hero prints its heading as the page's <h1>. If your theme prints the title of the page as well, hide one of the two (the page title block, or use a Heading instead of a Hero).
  • Badge with Position → Pinned sits on a corner of the component it is in.