Render an HTML element before the menu with hook preprocess menu
In this case you should edit the template. Changes to markup should be done in templates.


  Ok thank you. I will extend the twig file. But just to know. How do I add it within my preprocess function?


Looking into the standard menu.html.twig there isn't any place left to preprocess content to have it prefixed with some markup for example. There are just menu items that must be of type URL and attributes.

So your best bet probably is to add the markup to the block instead (in case you print your menu in a block).

/**
 * Implements hook_preprocess_HOOK().
 */
function MYTHEME_preprocess_block__footermenu(&amp;$variables) {
  $variables['content']['#prefix'] = '&lt;span&gt;This is my menu&lt;/span&gt;';
}