'How to disable labels for additional properties with react-jsonschema-form?

I am trying to use this playground to find a schema which will allow me to show an object addable custom properties (basically I want the user to enter an associative array).

When I do this:

{
  "title": "My object",
  "type": "object",
  "additionalProperties":  true
}

I get this

But I don't want the titles "newKey Key" and "newKey" to show.

I tried disabling labels in the uischema

{
  "additionalProperties": {
      "ui:label": false
  }
}

But that only disables them for the values, not the keys

How do I get rid of the "newKey Key"?



Solution 1:[1]

You don't need additionalProperties, use below code:

{
  schema: {
    newKey: {
      type: "string"
    }
  },
  uiSchema: {
    newKey: {
    "ui:widget": "select2",
    "ui:options": {
      label: false
    }
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 A_J