react-jsonschema-form
react-jsonschema-form copied to clipboard
Add `minRemovable` options
RJSF supports addable and removable options but does not currently support hiding the remove buttons when minItems is met. I propose the following option (or similarly named one) be added:
minRemovable option
A remove button is shown by default even when the number of items is less than or equal to minItems. You can turn this off with the minRemovable option in uiSchema:
const uiSchema = {
"ui:options": {
minRemovable: false
}
};
I've since learned that the add button is not shown once maxItems is worth so I've updated this issue to only add a minRemovable option.
Hmm. I didn't realize we don't show an add button once we reach maxItems. (I even wrote about it in the README.) Personally, I would have said we should show buttons in all cases. I agree that some users want to prevent users from "coloring outside of the lines", as it were, but I feel like such a granular option as minRemovable is too granular -- in general, I would expect a developer to either want none of the safety guards, or all of them. So I would prefer to see a larger-grain option, perhaps at the root of the uiSchema, that adds all of the safety possible. What do you think about that? I understand it's a more invasive change, but I think it's a more holistic approach.
Yeah, I like that. I'm currently involved more heavily in some other projects at the moment but when I circle back to the one where we're using rjsf I'll take a look at a more in depth change (unless someone beets me to it).