---
description: Javascript library to detect collisions between DOM Elements
---

# Introduction to HitboxJS

## What is HitboxJS ?

HitboxJS is a JS library that can help you detect collisions or intersections between **elements in your DOM**.

It can be used if your are building complex interfaces with, for example, rectangle selection, or if you're building a game\*.

{% hint style="warning" %}
\*If you are building a game, you are probably using a canvas so this library is not for you (and if not, maybe you should consider switching to canvas [for performance reasons](https://stackoverflow.com/questions/38901951/canvas-vs-svg-for-games)). HitboxJS only detects collisions and intersection **between DOM Elements**.
{% endhint %}

HitboxJS watches your elements and fires an event when **two elements** collide.

If you want to give it a try you can first install the library.

{% content-ref url="getting-started" %}
[getting-started](getting-started)
{% endcontent-ref %}

