Element Lists

When a selector includes "returnAll": true, the generated method returns a list.

In the DOM, a parent can contain multiple instances of a nested element, like lightning-tab components inside a lightning-tabset. If the selector has a returnAll property set to true, the method returns a list of instances found at run time.

From the previous JSON, UTAM generates this public method, which returns a list of the page objects of the given type.

To get one of the instances by its index, add :nth-of-type(%d) to the injected selector and the args property with an index parameter. :nth-of-type(%d) is 1-based, not 0-based.

The generated method finds all the custom elements inside the parent and returns one by index.

Sometimes a list element can have nested element, in the example below it's <lst-template-list-field> inside <dd>:

The UTAM grammar allows you to include nested elements within lists:

Because "recordCardField" is a list, the UTAM compiler will automatically generate a getter method with an index parameter in order to access the "listField" nested element.

Here's what the generated code might look like:

  1. For JavaScript:
  1. For Java: