# TryRemoveComponent<T>()

> Removes the attached component of type T, if one is attached.

## Definition

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

```csharp
public bool TryRemoveComponent<T>() where T : struct, IVisualElementComponent
```

### Returns

| Type                                                          | Description                                                      |
| ------------------------------------------------------------- | ---------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if a component was removed; `false` if none was attached. |
