How can I hide/disable Enum Values in UI Schema?

Hello, we have a requirement where we cannot change the JSON Data Schema in order to say what enums are available, instead we must use the UI schema to hide or disable certain enum options. Is there currently a way to do this? In case it is not, would a feature request for this be out of place?

Hi @joey,

This is currently not a supported use case of the off-the-shelf renderer sets. This is the first time this use case came up, so I don’t think this special use case is warrant enough to support this feature officially in our provided renderer sets.

However implementing this feature in a custom renderer should be very straightforward. You can basically copy the existing enum renderers and just apply an additional filtering on the options.

Note that a different way of supporting the described feature would be to programmatically process the JSON Schema before handing it over to JSON Forms, removing all enum values which you don’t want to see in the UI. Would this be a valid approach for you?

Hello @sdirix ,

Thanks for the quick reply. I appreciate it!

I think either of the two proposed approaches would work. Thanks again!

Kind regards

1 Like