---
title: "subscript(componentType:)"
framework: realitykit
role: symbol
role_heading: Instance Subscript
path: "realitykit/entity/componentset/subscript(componenttype:)-8y2jv"
---

# subscript(componentType:)

Gets or sets the component of the specified type.

## Declaration

```swift
@abi(@MainActor @preconcurrency subscript<T>(componentType: T.Type) -> T? where T : Component { get set }) @MainActor @preconcurrency subscript<T>(componentType componentType: T.Type) -> T? where T : Component { get set }
```

## See Also

### Accessing components

- [subscript(_:_:)](realitykit/entity/componentset/subscript(_:_:)-404se.md)
