---
title: Tres Components
description: Learn how TresJS automatically maps Vue components to Three.js objects using a custom renderer and autogenerated catalogue.
---
The core idea of **TresJS** is to provide an _autogenerated catalogue_ of all the Three.js elements. This catalogue is generated based on the Three.js source code, so it's always up to date.
When using plain Three.js, you need to import the elements you want to use. For example, if you want to use a `PerspectiveCamera`, you need to import it from the `three` package:
```js
import { PerspectiveCamera } from 'three'
const camera = new PerspectiveCamera(45, width / height, 1, 1000)
```
::tip{icon="i-ph-lightbulb-duotone"}
With **Tres** you don't need to import anything, that's because **Tres** automatically generates a **Vue Component based of the Three Object you want to use in PascalCase with a Tres prefix**.
::
For example, if you want to use a `PerspectiveCamera` you would use the `` component.
```vue
```
This means that you can rely on the same [documentation](https://threejs.org/docs/?q=Perspe#api/en/cameras/PerspectiveCamera) as you would when using plain Three.js, but with the power of Vue.
## Declaring objects
If we follow this argument, you should be able to lay out an instance like this: ❌
```vue
```
But with Tres this is not needed, you can define properties declaratively like this: ✅
```vue
```
TresJS follows a simple naming convention: any component prefixed with `Tres` is automatically mapped to its Three.js counterpart. Some examples:
| Vue Component | Instance |
|---------------|-------------|
| `` | `new THREE.PerspectiveCamera()` |
| `` | `new THREE.Mesh()` |
| `` | `new THREE.BoxGeometry()` |
| `` | `new THREE.MeshBasicMaterial()` |
## Constructor Arguments with `args`
Many Three.js objects require constructor arguments. TresJS provides the `args` prop as an **array of constructor arguments** that are passed directly to the Three.js constructor:
For example, the `PerspectiveCamera` constructor has the following arguments:
- `fov` - Camera frustum vertical field of view
- `aspect` - Camera frustum aspect ratio
- `near` - Camera frustum near plane
- `far` - Camera frustum far plane
To pass these arguments to the `` component, you can use the `args` prop:
```vue
```
### Basic Usage
```vue
```
### Common Patterns
::code-group
```vue [Geometries]
```
```vue [Cameras]
```
```vue [Lights]
```
::
## Declarative Properties
Beyond constructor arguments, TresJS allows you to set properties declaratively using Vue props:
### Property Mapping
```vue
```
### Shorthand Properties
TresJS provides convenient shorthands for common transformations:
```vue
```
### Set Methods
Properties with `.set()` methods can accept arrays:
```vue
```
## Extending the Catalogue 🔌
Tres offers bare bones functionality, but it's easy to add third-party elements and `extend` them into its internal catalogue.
Most of 3D experience uses `OrbitControls` which is not part of the core threejs library. You can add it to your project by importing it from the three/addons/controls/OrbitControls module.
```js
import { OrbitControls } from 'three/addons/controls/OrbitControls'
```
Then you can extend the catalogue with the `extend` function:
```vue { 2-4, 6-7, 13, 15}
```