Skip to content

Using LayoutGridField for an array instead of an object #4676

@efagerberg

Description

@efagerberg

Prerequisites

What theme are you using?

mui

What is your question?

Hello, I am wondering how one would set up their uiSchema to get it to render an array of fields.

I found the docs and the layout grid sandbox (sorry no anchor link) very helpful but it only really covers objects.

My specific scenario is I have a field in my schema which is an array of 3 element tuples (arrays with max and min items set). I would like each row to be layed out such that each element in the inner list is next to one another in that row.

Such a property may look similar to:

{
    "example": {
        "type": "array",
        "prefixItems": [
        {
            "maxItems": 3,
            "minItems": 3,
            "prefixItems": [
                {
                    "type": "integer"
                },
                {
                    "type": "integer"
                },
                {
                    "type": "integer"
                }
            ],
            "type": "array"
        },
        // more items
    ],
}

With the actual data coming in as

{
   example: [
      [6, 16, 50],
      [7, 14, 31],
      [7, 14, 31],
      [7, 14, 31],
      [7, 21, 38],
      [7, 21, 38],
      [7, 26, 50],
    ],
}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions