I have a custom module where I am trying to use custom twig templates based on the *user* *view mode*. The templates files I am trying to add to my theme are:

* `user.html.twig`
* `user--compact.html.twig`
* `user--token.html.twig`

These reside in a folder called `MYMODULE/templates/`.

This is my current module code:

**module\_name.module:**

```
/**
 * Implements hook_theme().
 */
function MYMODULE_theme($existing, $type, $theme, $path) {

  return [
    'user' => [
      'template'  => 'user',
      'base hook' => 'user',
    ],
    'user__compact' => [
      'template'  => 'user--compact',
      'base hook' => 'user',
    ],
    'user__token' => [
      'template'  => 'user--token',
      'base hook' => 'user',
    ],
  ];

}

```