-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to hide dropdown for single-option oneOf / anyOf / allOf #3425
Comments
Note that this feature would need to be opt-in because the selection field may contain information that is not captured in the lone subschema in oneOf/anyOf/allOf. @CiaranMn This sounds like it would be a useful feature! We would be open to reviewing a pull request that adds it. |
Thanks @nickgros – I'm going to look at ways this might be achieved and then come back with any questions before opening a PR. |
have a similar situation here.
is there any way to hide the dropdown completely? we are only using the anyOf to ensure that one of those boxes were checked. we were using this as a workaround in 2019 this structure, but since upgrading, we've noticed this dropdown is showing up (w/ the fieldset and legend) . we would just update the structure to use an array but we already have old data submissions that would be affected when rendering. anything we can add in the uiSchema to target the select dropdown and hide it? |
You can use the |
This is not clear enough, how could i use the "ui:widget": "hidden" to hide the select widget used by the anyOf? |
Hey @igorbrasileiro this could be helpful #3834 (comment) |
I'm running into this same issue. Could someone come up with an example of how to hide the dropdown completely? I'm including my playground example as an illustration. I really just need to hide the dropdown. |
Folks, you may want to check out the workaround in #3834 where you can use |
Prerequisites
What theme are you using?
core
Is your feature request related to a problem? Please describe.
We have a project where users build schemas composed of other schemas. We extend and limit JSON schema using custom meta-schemas to standardize certain things.
The relevant consequence of this is that it is possible to end up with
oneOf
andallOf
fields that contain one item, which means an unnecessary dropdown containing one item.For our purposes, it would be great to have an option to hide the dropdown if it only contains one option.
Describe the solution you'd like
A
uiSchema
option which, iftrue
, would hide the select widget inMultiSchemaField
if it contained only one option.Describe alternatives you've considered
I appreciate that this is a non-standard use case that depends on both:
(a) allowing users to create schemas which are unknown ahead of time
(b) using fields such as
oneOf
even if the schema could be represented in normal JSON schema without themI have considered patching or forking the library, or using a custom
MultiSchemaField
which implemented the behavior above. I suspect the last is likely the best option absent in-built support but welcome advice. All would be messier and require ongoing investment to keep up to date, so I thought I would see if there was any appetite for this feature first.The text was updated successfully, but these errors were encountered: