# OfType

> Selects all elements of the specified Type (eg: Label, Button, ScrollView, etc).

## Definition

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

## OfType\<T>(string, string\[])

Selects all elements of the specified Type (eg: Label, Button, ScrollView, etc).

```csharp
public UQueryBuilder<T2> OfType<T2>(string name = null, params string[] classes) where T2 : VisualElement
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with this name.**** (\[string\[]]\(https\://learn.microsoft.com/dotnet/api/system.string)): If provided, it selects elements with all the specified classes (case sensitive, to be distinguished from Type).

### Returns

| Type                                                                                          | Description                                                  |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [UQueryBuilder\<T>](/engine/6000.5/script-reference/unityengine/uielements/uquerybuilder1.md) | QueryBuilder configured with the associated selection rules. |

## OfType\<T>(string, string)

Selects all elements of the specified Type (eg: Label, Button, ScrollView, etc).

```csharp
public UQueryBuilder<T2> OfType<T2>(string name = null, string className = null) where T2 : VisualElement
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with this name.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): If specified, will select elements with the given class (not to be confused with Type).

### Returns

| Type                                                                                          | Description                                                  |
| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| [UQueryBuilder\<T>](/engine/6000.5/script-reference/unityengine/uielements/uquerybuilder1.md) | QueryBuilder configured with the associated selection rules. |
