> Markdown version of [Integrating components in a PolymerTemplate](https://vaadin.com/docs/v10/flow/polymer-templates/tutorial-component-integration). Section index: [llms.txt](https://vaadin.com/docs/v10/flow/llms.txt)

## <a id="detecting-whether-your-component-is-part-of-a-polymertemplate"></a>Detecting whether your component is part of a [PolymerTemplate](https://vaadin.com/docs/v10/flow/polymer-templates/tutorial-template-basic.md)

When creating your own component, you may want to execute custom logic depending on the component was mapped in a template (by being injected via `@Id` or `@Uses`) or was created directly using one of its constructors.

To do that, you can call the `isTemplateMapped` method from your component. For example:

```java
@Tag("div")
public class MyComponent extends Div {

  public MyComponent() {
    if (!isTemplateMapped()) {
      getElement().getStyle().set("color", "red");
    }
  }
}
```

In this example, the component only sets a style by default when the component is not part of a template.

To know more about `@Id` mappings, check the [Binding Components from a PolymerTemplate](https://vaadin.com/docs/v10/flow/polymer-templates/tutorial-template-components.md) tutorial.
