# IVisualElementComponent

> The interface for all UI Toolkit component structs.

## Definition

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

```csharp
public interface IVisualElementComponent
```

## Remarks

You don't implement this interface yourself: when you declare a `partial struct` with the [VisualElementComponentAttribute](/engine/6000.7/script-reference/unityengine/uielements/visualelementcomponentattribute.md), Unity's source generator adds the interface to the generated part of the struct. The interface is an implementation detail of that generator: its members are not a stable API, and Unity can add, change, or remove them in any version. The component methods on [VisualElement](/engine/6000.7/script-reference/unityengine/uielements/visualelement.md), such as [VisualElement.AddComponent](/engine/6000.7/script-reference/unityengine/uielements/visualelement/addcomponent.md), accept any struct that has it. The hooks are emitted by the source generator, never written by hand. They let `AddComponent` / `RemoveComponent` (un)register a component's `[RegisterCallback]` handlers and validate its `[RequiresElementOfType]` owner constraint through a constrained generic call, resolved by the compiler, so there is no reflection and no boxing of the component struct. A component that declares no callbacks (or no owner constraint) gets empty generated bodies. The storage hot path (`GetComponent`) never calls these, so it is unaffected.
