Problem/Motivation

Under /admin/config/content/canvas-builder/components we can enable / disable style properties globaly for all SDCs.

Would it be possible to make this overridable on a per-SDC basis?

By the way, what a stunning module! I was blown away while testing it.

Proposed resolution

I imagine that there will be 'default properties', as there are now, and below that, all active SDCs will be listed with a checkbox labelled 'Override'. Selecting “Override” completely overrides the default settings, enabling the attributes to be explicitly enabled or disabled for that specific SDC.

Example: I'd like to enable the 'Button Size' property for a card and a button SDC.

Faky UI Mockup of the proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

thomas.frobieter created an issue. See original summary.

thomas.frobieter’s picture

Title: Style features per SDC » Override style features per SDC
thomas.frobieter’s picture

Issue summary: View changes
thomas.frobieter’s picture

Although I still think this feature is useful, I’ve since discovered that SDC properties can be easily moved to the respective Canvas Builder tab via the 'x-canvas-group: content/style/advanced' key. This is generally a much more elegant solution.

I’m not yet sure whether it is also possible to have nested subgroups using x-canvas-group.

Furthermore, Canvas Builder styles are generally added to the wrapper that surrounds the actual SDC markup. This would make my button example redundant anyway.

aaronchristian’s picture

Hey @thomas.frobieter,

Ahh, I'm glad you like the module! The goal has always been to make Canvas a bit more usable out of the box.

Funny enough, while I was working on this part of the module I had the exact same thought. It didn't quite make the first release, but your feedback definitely validated that it was worth adding, so thanks for that!

You're right, the module adds a wrapper with classes, similar to what we did in Bootstrap Layout Builder, and Bootstrap Styles... but built for Canvas.

The goal isn't to replace developer-built SDCs like Buttons or Cards. It's more about providing the structural and reusable styling pieces needed to build responsive pages in Canvas without tying it to a specific framework.

Right now it provides two SDCs: Section and Column. These handle the page structure, and the AI submodule also uses them when generating layouts.

Previously we'd create wrapper SDCs like:

  • Statistics (wrapper SDC)
  • Statistics Item (element SDC)

But Canvas makes it really easy to accidentally place an item outside of its intended wrapper. By moving that structural responsibility into Canvas Builder, we can keep component libraries cleaner and let developers focus on actual content components.

I'm planning another release in the next few days, mostly around the AI work, but I'll make sure this gets included too.

I'll update the issue once I have it working with a proper test. Since the module is still early in its lifecycle, I'll probably merge it into 1.0.x and address anything that comes up in follow-up issues.

Cheers,

Aaron

thomas.frobieter’s picture

You're right, the module adds a wrapper with classes, similar to what we did in Bootstrap Layout Builder, and Bootstrap Styles... but built for Canvas.

The goal isn't to replace developer-built SDCs like Buttons or Cards. It's more about providing the structural and reusable styling pieces needed to build responsive pages in Canvas without tying it to a specific framework.

Right now it provides two SDCs: Section and Column. These handle the page structure, and the AI submodule also uses them when generating layouts.

That makes perfect sense to me. At first, I was hoping this approach would give me better form widgets for the settings (especially the color swatches). That led me down the wrong path at the beginning.

The extra wrappers aren't a problem either; we've handled that very similarly in our Paragraphs module.

I'm planning another release in the next few days, mostly around the AI work, but I'll make sure this gets included too.

Great! I'm looking forward to seeing how this develops. We'll definitely include Canvas Builder as a standard module. I hope I won't have to bother you with too many issues over the next few weeks 😅

aaronchristian’s picture

This is now in the 1.0.x branch.

CB Component Overrides

aaronchristian’s picture

Status: Active » Needs review
thomas.frobieter’s picture

This is a much better approach — it's much less cluttered. I like it!

It works pretty well, too.

@grevil, would you be so kind to review the code?

grevil’s picture

Status: Needs review » Reviewed & tested by the community

LGTM and already commited anyway!

Thanks @aaronchristian!

grevil’s picture

Status: Reviewed & tested by the community » Fixed

Setting to "Fixed" as this was commited already. I hope that is fine for you @aaronchristian! If not, feel free to let me know! :)

Also, we'd really appreciate a new release, since our pipeline is currently failing because of the missing construct argument, that got fixed in #3613873: ArgumentCountError: Too few arguments to function Drupal\canvas\AutoSave\AutoSaveManager::__construct() after updating to Canvas 1.9.0.

Thanks once again, for this wonderful module! 🎉

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

aaronchristian’s picture

Awesome appreciate it @grevil, yes that works for me.

Ah yess i see some failures. I think i got it all fixed up, just waiting on the last test to pass then ill cut a new release!

aaronchristian’s picture

Status: Fixed » Closed (fixed)