github rjsf-team/react-jsonschema-form v0.33.0

latest releases: 5.18.3, v5.18.3, 5.18.2...
7 years ago
  • Merged #224: Added a multiple checkboxes widget.

Multiple choices list

The default behavior for array fields is a list of text inputs with add/remove buttons. Though there are two alternative simpler widgets for common situations like picking elements against a list of choices; typically this maps to a schema having:

  • an enum list for the items property of an array field
  • with the uniqueItems property set to true

Example:

const schema = {
  type: "array",
  title: "A multiple choices list",
  items: {
    type: "string",
    enum: ["foo", "bar", "fuzz", "qux"],
  },
  uniqueItems: true
};

By default, this will automatically render a multiple select box. If you prefer a list of checkboxes, just set the uiSchema ui:widget directive to "checkboxes" for that field:

const uiSchema = {
  "ui:widget": "checkboxes"
};

See the "Arrays" section of the playground for cool demos.

Don't miss a new react-jsonschema-form release

NewReleases is sending notifications on new releases.