Class LitRenderer<SOURCE>

  • Type Parameters:
    SOURCE - the type of the model object used inside the template expression
    All Implemented Interfaces:
    Serializable

    @JsModule("./lit-renderer.ts")
    public class LitRenderer<SOURCE>
    extends Renderer<SOURCE>
    LitRenderer is a Renderer that uses a Lit-based template literal to render given model objects in the components that support the JS renderer functions API. Mainly it's intended for use with Grid, ComboBox and VirtualList, but is not limited to these.
    Since:
    22.0.
    Author:
    Vaadin Ltd
    See Also:
    of(String), https://lit.dev/docs/templates/overview/, <vaadin-combo-box>.renderer, Serialized Form
    • 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)
      • render

        @Deprecated
        public Rendering<SOURCE> render​(com.vaadin.flow.dom.Element container,
                                        com.vaadin.flow.data.provider.DataKeyMapper<SOURCE> keyMapper,
                                        com.vaadin.flow.dom.Element contentTemplate)
        Deprecated.
        LitRenderer doesn't support