Class LitRenderer<SOURCE>

    • Method Detail

      • of

        public static <SOURCE> LitRenderer<SOURCE> of​(String templateExpression)
        Creates a new LitRenderer based on the provided template expression. The expression accepts content that is allowed inside JS template literals, and works with the Lit data binding syntax.

        The template expression has access to:

        Examples:

         
         // Prints the `name` property of a person
         LitRenderer.<Person> of("<div>Name: ${item.name}</div>")
                  .withProperty("name", Person::getName);
        
         // Prints the index of the item inside a repeating list
         LitRenderer.of("${index}");
         
         
        Type Parameters:
        SOURCE - the type of the input object used inside the template
        Parameters:
        templateExpression - the template expression used to render items, not null
        Returns:
        an initialized LitRenderer
        See Also:
        withProperty(String, ValueProvider), withFunction(String, SerializableConsumer)