Create Multiple Select dropdown / Reuse Categories Component

Hey, im working on a custom module. The Module generator works great. But I need a Multiple Select dropdown. I have no Idea how to reuse the Dolibarr component for this. To code somethin new would be easy but I dont think that this would be the “Dolibarr way”

I’ve seen a a Multiple Select in Products → Categories (using the module categories)

TLDR;
How can I reuse the categories component in a custom module?

@Felix_Ruby

multiselectarray() is what you are looking for.

https://doxygen.dolibarr.org/13.0/df/d08/class_form.html#a74981801afca44852e915b99d1cde763

The previous link is no longer available. Here is an updated link to version 16.0 from doxygen: dolibarr: Form Class Reference

The multiselectarray() function is currently in htdocs/core/class/html.form.class.php You can also review it on GitHub: dolibarr/htdocs/core/class/html.form.class.php at develop · Dolibarr/dolibarr · GitHub