Problem/Motivation
Sometimes component libraries include components that are intended for internal use within the design system. These components should not be exposed to display builders like UI Patterns or Experience Builder.
It would be great to still be able to leverage the SDC ecosystem for these components, because it allows the automatic loading of the components including CSS and JavaScript and validation of props and slots.
Proposed resolution
Allow SDCs to be marked to be excluded from UI. This could be done with a new no_ui property on the SDC YAML.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3535958
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3535958-sdc-exclude-ui
changes, plain diff MR !12723
Comments
Comment #2
lauriiiSomething that came up before is how this relates to #3514072: SDC slots can set expectations and cardinality . I actually don't think this is exactly the same as what's being worked on there. What we want to do here is prevent exposing the component to the UI at all. The difference is that this is the component indicating it should be hidden from the UI, vs #3514072: SDC slots can set expectations and cardinality where it might be possible for the canvas to indicate what components it can accept.
Comment #3
kristen polThis is a good idea as there are often components that aren’t meant to be used by the end user directly.
Comment #5
pdureau commentedGreat idea. 2 proposals:
SDC's status property
We already have the
statusproperty:https://git.drupalcode.org/project/drupal/-/raw/HEAD/core/assets/schemas...
Display building tools can ignore "obsolete" components, for example. Do we add an "internal" value?
Drupal plugins's no_ui
The Laurii's proposal. Some Drupal plugins have a
no_uiproperty (declared as PHP attributes because of the discovery, it will be in YAML for SDC):For example, in FieldType:
Comment #6
mogtofu33 commentedI like this request, here is a starting point proposition.
I would like to challenge the
no_uiterm because of negative naming (boolean blindness).I understand it's used on plugins, but we can go to
has_uias defaulttrue.Comment #8
mogtofu33 commented@pdureau is fast, so my proposition is a 3rd one,
has_uiwith defaulttrue!Comment #9
kristen polI wouldn’t want to use obsolete to convey this as it’s misleading. The internal or no_ui approaches seem fine. I prefer the former only so there are less things to define but perhaps it’s confusing to mix things like stable and internal
Comment #10
pdureau commentedWhat is happening is this optional property is missing (which will be the case for most of the components)
status, if missing, we show the component in UIno_ui, if missing, it is likeno_ui = falseso we show the component in UIhas_ui, if missing, is it likehas_ui= true?Comment #11
mogtofu33 commentedYes with
has_ui, if missing, it is likehas_ui= trueComment #12
lauriiiThe reason I think this should be separate from
statusis that internal / no UI components have a lifecycle too. You may want to deprecate an internal component too or have an internal component be experimental.It seems that
no_uiwould be most consistent with the rest of Drupal which is why I proposed that. I'm not againsthas_uibut betweenno_uiandhas_ui, they feel equally clear to me withno_uibeing more consistent. I'll let @pdureau to make the final call here. 😊Comment #13
pdureau commentedOf course, "obsolete" was just an example of some filtering UI tools are already able to do. If we go the
statusway, we need a new value.However, there is the cardinality issue: is a component able to be "internal" and "experimental"/"stable"/ "deprecated"/"obsolete" at the same time? If yes, let's go for
no_uiorhad_ui. If no,statushas my (little, not enforced) preference.Comment #14
pdureau commentedSo, let's forget
status😉Comment #15
lauriiiI would imagine the default values would be these:
I believe that if component doesn't provide any of these props, display builders should happily use the component.
Comment #16
sonam_goswami55 commentedThis is a very useful addition, especially for design systems that include internal or utility components not meant for end-user selection. I agree with the preference for using has_ui (default true) over no_ui due to better readability and avoiding boolean blindness.
Also, keeping this separate from status seems clearer, since internal as a status could be misinterpreted as lifecycle-related rather than visibility-related. This distinction helps maintain clarity for both developers and UI tools.
Thanks to @lauriii, @mogtofu33, and @pdureau for moving this forward quickly!
Comment #17
mogtofu33 commentedBack to
no_uias it makes more sense if missing then it isfalse.Comment #18
pdureau commentedThanks for the fast MR @mogtofu33
I guess you also need to update:
Comment #19
lauriiiOpening the bikeshed of the year; it looks like SDC is using camelCase for the properties. Should we name this as
noUithen? 😅 Again, I'm fine with anything but just pointing it out after realizing this.Comment #20
pdureau commentedIndeed, SDC is using camelCase for
libraryOverridesandthirdPartySettings(only).JSON schema is mixing:
additionalProperties)x-translation-context)I would personally prefer the Drupal wide consistency (
no_ui) than the SDC wide consistency (noUi). But this is not a strong opinion.Comment #21
lauriiiIn the other scenarios where we're using
no_ui, other properties are using snake_case too. It looks like all of the SDC properties are currently camelCase so we'd be introducing the first deviation from that. I think we should avoid that since we can. But again, no strong opinions here, just trying to help us close this as quickly as possible with something reasonable 😅Comment #22
mogtofu33 commentedSchema added, description and title could be optimized, feel free to update them directly on the MR.
Comment #23
pdureau commentedThanks. I may remove any mention of "internal". "No UI" is already descriptive enough.
Comment #24
kristen polHmm… don’t like “property” used in description but see it’s in status
Perhaps:
Title: Exclude from UI
Description: Use “true” to exclude a component from the UI and “false” to show it
Though I don’t love that either
Comment #25
effulgentsia commentedI would have agreed with this if we didn't already have
thirdPartySettingsin SDC yaml butthird_party_settingsin config. But given that we have that, I think it would be weird to makeno_uithe outlier for a key that we don't camelCase.Comment #26
kristen polI would do camel case to be locally consistent even if it’s not globally consistent
Comment #27
pdureau commentedOK for me. The analogy with
thirdPartySettingsandthird_party_settingsis convincing. I will do the changes soon.Also, thanks @sonam_goswami55 for your feedbacks, and welcome to the community.
Comment #28
nod_So we have:
Why not call it
internaldirectly? not as a new value of status but additionally.We already have a sort of internal prefix for libraries we don't want people to rely on, that would solve the camelcase issue too
Comment #29
lauriiiInternal is semantically different from hiding something from the UI. The idea of
noUiis that you could provide SDCs that are API like the image component being built into Experience Builder, but it may not make sense to expose them to the UI.Comment #30
nod_I see that makes sense.
I'm not super happy with the negation, can we have something clearer, it's not obvious that UI = display builders, no_ui could mean the component only output hidden html (script tags). I'm all for consistency but is there a big overlap of folks writting SDCs and FieldTypes/views plugins that needs to be hidden?
I asked some AIs for the naming, got a few interesting suggestions:
uiHidden(clearer that the SDC has an output, just we don't want to list it),excludeFromUiBuilderslonger but can't really argue about the clarity.Even got
headlessas a suggestion since it's for programmatic use, not saying we should use that but it's an interesting take on the situation :)Comment #31
pdureau commentedYou are joining Jean's initial position here.
noUIwas picked because it was already a Drupal thing and the mechanism we are proposing is the same:Comment #32
nod_fair enough, let's go with that
Comment #33
penyaskitoReally don't want to bikeshed this, but #25 had a great argument for using camel case which seems it convinced most detractors (+1 with myself).
"Exclude from UI" is probably more accurate than "Internal" for the schema docs.
Comment #34
pdureau commentedAgree & agree. I will do the change as soon as I can.
Comment #35
penyaskitoDone that myself 😄
Comment #36
pdureau commentedIt is a surprising move, but thanks you.
However, but there are still mentions of "internal" in descriptions. "No UI" is already descriptive enough and I am afraid "internal" will add confusion.
Comment #37
lauriiiFixed it within Gitlab 😇
Comment #38
pdureau commentedOK great, I will commit it.
Comment #39
lauriii+1, this is looking good! Glad we were able to resolve this quickly. This is a nice improvement for folks configuring UI/page builders!
Comment #41
pdureau commented♥️
Committed 9e51e1e and pushed to 11.x. Thanks!
Comment #42
pdureau commentedComment #43
pdureau commentedComment #45
wim leersThere's no change record yet 😅
Comment #46
pdureau commentedthanks Wim :)
Comment #47
longwaveNeeds work for the change record.
Comment #48
igorgoncalves commentedThat will be an awesome improvement, thanks to you all.
Here's the change record draft i created: https://www.drupal.org/node/3542594
Comment #49
smustgrave commentedCR reads fine to me. Can't wait to add this to some of my ui_suite_uswds components. I didn't mark fixed as didn't want to jump the gun.
Comment #50
nod_Change record should explain a bit where that is used (not used in core yet) administrative uis of drupal canvas and display builder for examples.
Also SDC do not stand for 'Structured Data Component (SDC)', so some work to the change record wouldn't be bad
Comment #51
nod_Comment #52
penyaskitoCR changes: Fixed SDC acronym definition, changed target audience to include Themers, included reference page builders and a note that it's each page builder choice to decide if they respect this metadata.
I'm still not 100% happy with the CR, but RTBC to put this in front of nod_ and pdureau eyes.
Comment #53
nod_It's not just good, it's good enough!
Comment #55
pdureau commentedThanks nod_
Comment #56
gábor hojtsyAdding to release highlights.