# Set title of list-item for different types

**URL:** <https://jsonforms.discourse.group/t/set-title-of-list-item-for-different-types/1526>\
**Category:** General\
**Created:** [June 9, 2023, 11:14am UTC](https://jsonforms.discourse.group/t/set-title-of-list-item-for-different-types/1526 "2023-06-09T11:14:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrMinister](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/mrminister/32/733_2.png) [@MrMinister](https://jsonforms.discourse.group/u/MrMinister)\
**Post date:** [June 9, 2023, 11:14am UTC](https://jsonforms.discourse.group/t/set-title-of-list-item-for-different-types/1526/1 "2023-06-09T11:14:39Z")

</div>

Hi,  
I want to build a Form for a schema where I have a main object which has a property called `modules`. This prop is an attribute which can have items of different types.

```auto
{
    "definitions": {
        "module_1": {
            "type": "object",
            "title": "contentitems_3",
            "properties": {
                "icon": {
                    "type": "string",
                    "enum": [
                        "navi_calendar"
                    ],
                    "description": "das Kalendericon",
                    "default": "navi_calendar"
                },
                "title": {
                    "type": "string",
                    "description": "mein Kalender",
                    "default": "mein Kalender"
                }
            },
            "required": [
            ]
        },
        "module_2": {
            "type": "object",
            "title": "timeterminal_2",
            "properties": {
                "icon": {
                    "type": "string",
                    "enum": [
                        "navi_timer"
                    ],
                    "default": "navi_timer"
                },
                "orientation": {
                    "type": "string",
                    "enum": [
                        "landscape",
                        "portrait"
                    ]
                }
            },
            "required": [
            ]
        }
    },
    "type": "object",
    "properties": {
        "modules": {
            "type": "array",
            "items": {
                "oneOf": [
                    {
                        "$ref": "#/definitions/module_1"
                    },
                    {
                        "$ref": "#/definitions/module_2"
                    }
                ]
            }
        }
    }
}

```

 ![image](https://global.discourse-cdn.com/free1/uploads/jsonforms/original/1X/0a7895f275fe5a9f4dcecc8903aaf123e6e1a5a0.png)

I am quite happy with how th result looks so far. But I need the list entry to show the “title” of the used module.  
I tried getting this to work uisng a ui-schema without succes.

```auto
{
  "type": "VerticalLayout",
  "elements": [
    {
      "type": "Control",
      "scope": "#/properties/modules",
      "options": {
        "elementLabelProp": "title"
      }
    }
  ]
}

```

How can I make this work?

Thank you for taking time to respond 🙂

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [June 12, 2023, 3:29pm UTC](https://jsonforms.discourse.group/t/set-title-of-list-item-for-different-types/1526/2 "2023-06-12T15:29:33Z")

</div>

Hi @MrMinister,

Sadly the `elementLabelProp` support is pretty basic and can only refer to a single instance data value. To use it you would need to maintain a property on the array entry which contains the label as you want to show it. While possible this is certainly a bit hacky.

You might want to think about using a [custom renderer](https://jsonforms.io/docs/tutorial/custom-renderers). You basically only need to copy the [`MaterialArrayLayoutRenderer`](https://github.com/eclipsesource/jsonforms/blob/a5fdca6fb6afa9820eabe8051401785675f53ad7/packages/material-renderers/src/layouts/MaterialArrayLayoutRenderer.tsx) and [`MaterialArrayLayout`](https://github.com/eclipsesource/jsonforms/blob/a5fdca6fb6afa9820eabe8051401785675f53ad7/packages/material-renderers/src/layouts/MaterialArrayLayout.tsx) and then customize the part [where the `elementLabelProp` is determined](https://github.com/eclipsesource/jsonforms/blob/a5fdca6fb6afa9820eabe8051401785675f53ad7/packages/material-renderers/src/layouts/MaterialArrayLayout.tsx#L105).
