XB is not loading components from base theme

Created on 13 August 2025, about 1 month ago

Overview

Experience Builder is not loading components from the active theme's base theme. This is pretty easy to reproduce, and I'm attaching a zip file with a reduced test case.

This is extremely important for me (and likely many theme/site-template devs). We're planning on bundling our shared library of components within a base theme, so they can easily be updated, etc.

Proposed resolution

Let's get dem components loadin'!

🐛 Bug report
Status

Active

Version

1.0

Component

Component sources

Created by

🇺🇸United States mherchel Gainesville, FL, US

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mherchel
  • 🇺🇸United States mherchel Gainesville, FL, US
  • 🇳🇱Netherlands balintbrews Amsterdam, NL
  • 🇺🇸United States mherchel Gainesville, FL, US
  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    Seems reasonable to me, but really a product decision.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • 🇺🇸United States mherchel Gainesville, FL, US
  • 🇫🇮Finland lauriii Finland

    Yep, this seems like an oversight.

  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
  • @penyaskito opened merge request.
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    I was seduced by this new bounty program.

  • 🇭🇺Hungary aboros

    Some of the SDCs in Radix theme break XB because of "invalid" prop definitions. For example the width prop is defined as type: ['string', 'null', 'integer']

    If XB will automatically load all components from the base theme it will break any site that has a Radix subtheme.

  • 🇳🇱Netherlands balintbrews Amsterdam, NL

    #12: That should be fixed as of How to pass content_attributes to SDC without it being shown in the XB UI Active .

    Nevertheless, this might be something to consider. As far as I know the idea of the Radix theme is that it ships a lot of SDCs, and you cherry-pick the ones you would like into your sub-theme. Loading everything from the base theme would go around that. Maybe the idea is unique to Radix, or not that common?

    On the other hand, you can still disable components for XB (/admin/appearance/component), so there is an option to exclude anything you may not want, it just requires an additional action.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    The code looks perfect, zero remarks! 🤩

    Test-only CI job fails as expected: https://git.drupalcode.org/project/experience_builder/-/jobs/6310203 👍

    @aboros: What does "break XB" mean? XB specifically ignores SDCs it cannot support, and explains why. (Logic: \Drupal\experience_builder\ComponentMetadataRequirementsChecker, UI: /admin/appearance/component/status.) For me right now for example:

    It's quite possible it's not yet handling the case of type being an array of types — if so, that'd be a simple addition to that logic, but that's a separate problem. Would you mind creating a new bug report for that, if that's the case? 🙏

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    mherchel-will-pay-weight-in-beer-to-get-fixed

    🍻😄

  • 🇳🇱Netherlands balintbrews Amsterdam, NL

    #14: I believe "break XB" means what was reported in 🐛 ValueError: "Drupal\Core\Template\Attribute" is not a valid backing value for enum Active , which was closed as a duplicate of How to pass content_attributes to SDC without it being shown in the XB UI Active . So that issue should be fixed now, except maybe what you pointed out, "the case of type being an array of types". Either way, separate issue.

    Before @penyaskito's change landed, it was impossible to expose SDCs from the base theme, and there is a way to opt out, so it's definitely a great step forward. However, I'm still wondering how many themes out there follow the logic of Radix, where the sub-theme uses only a subset of the provided SDCs. If this is a common pattern, we might want to consider one of the followings:

    1. Improving the opt-out experience with some focused tooling or UI to allow disabling all components from a sub-theme;
    2. Changing the logic of loading SDCs from the subtheme to be opt-in.
  • 🇭🇺Hungary aboros

    Sorry I was not aware most of the fixes, I just had experience with previous versions of XB breaking with a Radix sub-theme due to these "invalid" components. I will check again with recent versions and will open a new issue if I encounter any problems.

    This might be very opinionated but I in most cases I don't want all components of a base theme to be picked up automatically by xb. The opt-in method feels better for me but if there is a way to opt-out that is also fine.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    there is a way to opt out

    To be clear: a manual way to opt out: via the UI.

    Improving the opt-out experience with some focused tooling or UI to allow disabling all components from a sub-theme;

    +1 — and fortunately, that already exists: noUi: true. Introduced in Drupal 11.3 ( Allow SDCs to be marked to be excluded from UI Active ), and XB already supports it. But it won't work until Drupal 11.3.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
  • 🇺🇸United States mherchel Gainesville, FL, US

    To be clear: a manual way to opt out: via the UI.

    It'd be super nice if we could include config in our themes that dictates which components are disabled. I wonder if this already works.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    #21: you can't, because your theme can't know which modules will be installed on the site. The set of modules that is installed influences which field types are used for each SDC prop.

    Is Allow SDCs to be marked to be excluded from UI Active insufficient for you? Perhaps because some SDCs may be only relevant for a minority of sites, and you don't want your base theme to overwhelm users? 🤔
    If so: please open a new feature request issue and describe the rationale for what you're looking for 🙏 I'm sure it'd be feasible to go further.

  • 🇭🇺Hungary aboros

    a manual way to opt out: via the UI.

    I think that is completely fine. It is not that often that a site changes it's base theme after all.

Production build 0.71.5 2024