# AddComponent<T>(in T)

> Attaches a component of type T to this element.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.7/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## AddComponent\<T>(T)

```csharp
public void AddComponent<T>(in T value) where T : struct, IVisualElementComponent
```

### Parameters

**** (T): Initial component value.
