Array - min & max available items

Hi,
I have a question, if its possible to enable/disable “add item” button based on minItems, maxItems in jsonScheme?

In this time, when we define minItems or maxItems, in final form, there is displayed warning, but user can add more items up to defined limit.

jsonScheme definition:

 "sellers": {
            "type": "array",
            "minItems": 1,
            "maxItems": 2,
            "items": {...

The form:

As you can see, in our json scheme, we have defined min 1 item and max 2 items, but the “add button” is still enabled and allows user to add more than 2 items.

For the opposite situation, when user wanna delete the last seller, its also allowed, because the “delete button” is still allowed.

My question is, is it some how possible to enable/disable add/delete buttons base on the jsonScheme configuration? The warnings are not enough for good UX.

Thank you for reply!
Adam

Hi @adam.cernohorsky,

this feature is currently only implemented for the @jsonforms/vue2-vuetify renderers. For React Material you could write a custom renderer which supports the suggested functionality.

If you like you can also contribute this functionality to the existing React Material array layout renderer.

Hi, @sdirix thank you for fast reply! I thought that, but I rather ask first :slight_smile:

Adam