Skip to content

v0.33.0

Choose a tag to compare

@n1k0 n1k0 released this 02 Jun 15:15
· 1602 commits to main since this release
  • 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.