com.vaadin.flow.component.littemplate.

Class LitTemplate

  • All Implemented Interfaces:

    AttachNotifier, DetachNotifier, HasElement, Serializable


    public abstract class LitTemplate
    extends Component

    Component which renders a LitElement template.

    A LitElement template is defined in a JavaScript module which should be placed inside the frontend folder and loaded using @JsModule. The tag name defined for the Lit template must be defined using @Tag on this class.

    By annotating a field using @Id you can map a @Component instance to an element in the template, marked with an id attribute which matches the field name or the optionally given value to the annotation.

    Note that injected components will have the same limitations as with PolymerTemplate.

    For more information about the LitElement project, see https://lit-element.polymer-project.org/

    Since:

    Author:

    Vaadin Ltd

    See Also:

    JsModule, Tag, Id, Serialized Form

    • Constructor Detail

      • LitTemplate

        protected LitTemplate()

        Creates the component mapped to a LitElement.

    • Method Detail

      • getChildren

        public Stream<Component> getChildren()

        Gets the child components of this component.

        The default implementation finds child components by traversing each child Element tree.

        If the component is injected to a PolymerTemplate using the @Id annotation the getChildren method will only return children added from the server side and will not return any children declared in the template file.

        Please note that components defined using @Id are not child components. Only components explicitly added through methods such as HasComponents.add(com.vaadin.flow.component.Component...) or Node.appendChild(Element...) are returned by this method.

        Overrides:

        getChildren in class Component

        Returns:

        the child components of this component

        See Also:

        Id