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

This module adds a bunch of components that you can use with the Drupal Canvas module. They are based on the Bootstrap framework, so you need to have a theme that includes Bootstrap for these components to render and work well.

Features

✅ More than 40 components that you can use in drupal canvas pages
✅ Using the new canvas colorpicker widget
✅ Some settings widgets are customized for better UX
✅ Other widgets provide direct previews so you know what you're getting before selecting
✅ Added some responsive spacing options (for margins and paddings)
✅ Built in animation options for most components
✅ Based on the Bootstrap framework

Installation - canvas patch

There currently is a bug in the drupal canvas module that causes prop values to not properly be saved or loaded, causing an issue where changing one prop can lead to sudden changes in other props.
If you notice this problem, you can use the patch from #3591827
So for example add this to your composer patches section:

            "drupal/canvas": {
                "#3591827 Radio button props lose value when another prop changes": "https://git.drupalcode.org/-/project/19391/uploads/569feae73ba5b160c286f608b005bf7a/canvas-radios-current-value.patch"
            }

Installation - setup

After you've enabled this module, visit the color settings form at /admin/config/user-interface/sdc-components/colors and save it (you may edit colors like the default primary color etc). It will create a colors.css file (in your public folder) which defines bootstrap css variables based on the values from the form. That file will automatically be loaded on each page. If for example you set the primary color to purple, and then you edit a canvas component and give it the color primary, it will then be purple. Make sure your theme does not overwrite these bootstrap css variables.

Now this module is enabled and you should be able to see and use all the components provided by this module in the canvas ui (when creating/editing a canvas page).

Components

The components are organized into groups within the Canvas UI. Here is a list of the included components and the possible component settings.

Basic components

Button

Set text, url, target, button color/style, button size, add arrow inside, center, set margins, add animation, add extra classes
 Button

Heading

Set content, tag (h1, h2, etc), display size (larger text styles), url, color, icon before text, text alignment, margin, add animation, add extra classes
 Heading

Horizontal line

Set full width or shoter line, line width, line color, add margin, add animation
 Horizontal Line

Icon

Select (svg) icon from media library, select fill color, enter css color value for fill, set width, set height, add extra css styles, add margin, add animation, add extrsa classes
 Icon

Image

Select image from media library, set fixed width, set aspect ratio, set fetch priority, set loading, set to cover parent, add popup to original when clicking it, add popup to a video when clicking it, add url, center align, add margins, add animation, add extra classes
 Image

Text

Set wysiwyg content, color, display size (larger text styles), text alignment, margin, add animation, add extra classes
 Text

Video

Select video from media library, set youtube url, set poster image, set aspect ratio, fit to available size, show controls, autoplay on load, autoplay when scrolled into view, muted, loop, add margins, add animation, add extra classes
 Video

Advanced components

Accordion

Simpler style option, set margins, add animation, add extra classes. Drag Accordion Items first, then drag desired content into the desired Accordion Items.
 Accordion Accordion Item

Alert

Set alert type/style, Include a title, set content, set icon, add close button, set margins, add animation, add extra classes.
 Alert

Badge

Set content, color, shape, font size, add margins, add animation, add extra classes.
 Badge

Card

Set image, title, content, url, button text, add arrow to button text, make entire card clickable, set direction to horizontal card, shrink and fit image, center text, set image position, border color, border width, background color, text color, border radius, add margins, add animation, add extra classes.
 Card

Carousel

Create a slider from any component type. Add controls, indicators, enable touch swiping, generate thumbnails (if images), set autoplay and interval, display up to 3 items at once, set custom prev/next icons, set svg fill color for those icons, add margins, add animation, add extra classes.
 Carousel

Collapsible text

Set title, collapsible content (wysiwyg), text color, display size (larger text styles), text alignment, add margins, add animation, add extra classes.
 Collapsible Text

Hero

Large header sections with slots for additional content. Set background image, background position, background video from media library or youtube url, aspect ratio, url, add overlay, parallax effect, scroll down button, add margins, add animation, add extra classes.
 Hero

Icon with text

Set (svg) icon, text, icon position (next to or above text), icon color, icon width, icon height, extra css style, border color, add margins, add animation, add extra classes.
 Icon with text

Iframe

Set iframe src, title, width, height, add margins, add extra classes.
 Iframe

Image Gallery

Display a gallery of image thumbnails that open original in a modal when clicked. Add images, set thumbnail width, heigt and margin, loop, transition, display alt text as caption, add margins, add animation, add extra classes.
 Image gallery

Image with text on top

Set image, drag any content component like header or text, add overlay, set url, add an arrow, disable hover effect, set aspect ratio, add margins, add animation, add extra classes.
 Image with text on top

Label with text

Handy for a list of specifications. Add horizontal line, set margins, add animation, add extra classes.
 Label with text

Map (Leaflet)

Set map position via latitude and longitude, set width, height, max zoom level, default zoom level, marker popup content, add margins, add animation, add extra classes.
 Map (Leaflet)

Photosphere

For displaying 360 degree images. Select 360 image from media library, add margins, add animation, add extra classes.
 Photosphere

Quote

Set quote text, source, source description, backgorund color, aspect ratio, add padding, add margins, add animation, add extra classes.
 Quote

Review

Set review text, source, source description, stars out of 5, stars description, general background color, text ballon background color, star color, aspect ratio, add padding, add margins, add animation, add extra classes.
 Review

Layout

1 Column

 1 Column

2 Columns

 2 Columns

3 Columns

 3 Columns

4 Columns

 4 Columns

Flexbox

 Flexbox

Role Permission Content

This is a wrapper element where you can place any content into and select for which user roles this should be visible.
 Role Permission Content

Tabs

 Tabs Tab item

Wrapper

 Wrapper

Social Media Links

This is a general component where you can drag specific social media link components into, like Facebook or LinkedIn.
At this moment, those are the only 2 options that have been developed. Feel free to contribute on this!
 Social Media
 Social Media - Facebook

General

Back to top

Set background color and arrow color, and make it float on the bottom right on the screen.
 Back to top

Company address

Select logo from media library, set logo width, add address text (wysiwyg).
 Company address

Made by

Add a 'Made by xx' element. Set text, company name or logo (svg), logo position, logo color, logo width, logo height, url.
 Made by

Navigation

Add existing menu

Enter the menu id (like 'main'), add optional title and title color, set color scheme (light or dark)
 Add existing menu

Anchor

Add an anchor anywhere on the page you can link or jump to.
 Anchor

Anchor link

Create a link to an anchor on the page
 Anchor link

Anchor menu

Create a menu of anchor links
 Anchor menu

Navigation / Menu

Create a custom menu. Drag menu item components into it. Set item alignment, direction (horizontal or vertical), style, fill, add extra classes.
 Navigation / Menu Nav item

Navbar

Create a navigation bar that can have branding (logo), slogan, a menu, language switcher, etc. Set color scheme (light or dark), background color, breakpoint, placement (sticky, top or bottom), container, logo, logo width, slogan, add padding, add margins, add extra classes.
 Navbar

Additional Requirements

  • Canvas module
  • Bootstrap (5.3) based theme

Developer information

New twig function and filter

The module provides a custom Twig function: getSvg that will return the svg code of a given src. If src is not an svg but a regular image, then an < img > element will be returned.
The module also adds an custom Twig filter: addElementAttribute that you can use onto the getSvg so the svg or image element has the extra attributes. Example:
{{ getSvg(icon.src, icon.alt|default('Icon'))|addElementAttribute('width', '200px')|addElementAttribute('height', '50px') }}

Services

sdc_components.componentservice Provides utility logic for component configuration and management. For now it has the important convertWidgetsToRadios() function which will convert all our desired component prop select elements into radios elements.
This can manually be triggered by this command:
drush ev "\Drupal::service('sdc_components.componentservice')->convertWidgetsToRadios();"

AttachmentSize
SDC components: Button123.59 KB
SDC components: Heading143.92 KB
SDC components: Horizontal Line170.55 KB
SDC components: Icon131.55 KB
SDC components: Text149.62 KB
SDC components: Image606.19 KB
SDC components: Video990.46 KB
SDC components: Accordion306.59 KB
SDC components: Accordion Item225.2 KB
SDC components: Alert136.5 KB
SDC components: Badge137.54 KB
SDC components: Card293.75 KB
SDC components: Carousel824.22 KB
SDC components: Collapsible Text155.76 KB
SDC components: Hero697.76 KB
SDC components: Icon with text143.94 KB
SDC components: Iframe754.45 KB
SDC components: Image gallery941.95 KB
SDC components: Image with text on top595.48 KB
SDC components: Label with text221.54 KB
SDC components: Map (Leaflet)758.38 KB
SDC components: Quote181.22 KB
SDC components: Review184.27 KB
SDC components: 1 Column312.9 KB
SDC components: 2 Columns284.38 KB
SDC components: 3 Columns289.6 KB
SDC components: 4 Columns264.03 KB
SDC components: Flexbox258.97 KB
SDC components: Role Permission Content89.08 KB
SDC components: Tabs321.2 KB
SDC components: Tab item87.72 KB
SDC components: Wrapper262.1 KB
SDC components: Photosphere422.73 KB
SDC components: Social Media179.25 KB
SDC components: Social Media - Facebook82.92 KB
SDC components: Back to top172.19 KB
SDC components: Company address171.11 KB
SDC components: Made by199.86 KB
SDC components: Add existing menu157.21 KB
SDC components: Anchor82.49 KB
SDC components: Anchor link70.64 KB
SDC components: Anchor menu262.66 KB
SDC components: Navigation / Menu150.79 KB
SDC components: Navbar225.7 KB
SDC components: Nav item71.12 KB

Project information

Releases