Using showIf with nested list

Does someone know how to use showIf with nested List in Model

eg i have this Content Models in this format

// Content Models: Sample A
{
  Slug: Text
  Recommendations: List {
    Category: Text
    Type: Text ['search', 'fixed']
    Options: List {
      Item: Text
      placeId: Text (only appear if Type === 'fixed')
    }
  }
}

I want to hide placeId if the `Recommendations.Type === ‘fixed’ but couldnt get it to work

// showIf code
// how does this should look like?
return options.get('Recommendations.Type') === 'fixed'

Hello @ShortLink,

The problem: Inside subFields (nested Lists), showIf does not accept a function; it only works as a string expression.

The fix: Pass showIf as a template string instead of a function:

// ❌ Won't work inside subFields
showIf: (options) => options.get('Type') === 'fixed'

// ✅ Works inside subFields — pass it as a STRING
showIf: `options.get('Type') === 'fixed'`

Notice the key difference: no wrapping function, just the raw string expression. Builder evaluates it internally.

Here’s how your full Content Model registration should look:

Builder.registerContentType('Sample A', {
  fields: [
    {
      name: 'Slug',
      type: 'text',
    },
    {
      name: 'Recommendations',
      type: 'list',
      subFields: [
        {
          name: 'Category',
          type: 'text',
        },
        {
          name: 'Type',
          type: 'text',
          enum: ['search', 'fixed'],
        },
        {
          name: 'Options',
          type: 'list',
          subFields: [
            {
              name: 'Item',
              type: 'text',
            },
            {
              name: 'placeId',
              type: 'text',
              // ✅ String expression — references the sibling field 'Type'
              // @ts-ignore — TS types don't support strings here, but it works
              showIf: `options.get('Type') === 'fixed'`,
            },
          ],
        },
      ],
    },
  ],
})

Hope this helps!