Adding a suffix to a form element I have a form which has an input field for which i want to add a suffix.
function myapp_preprocess_form_element(&amp;$variables) {
  if ($variables[&quot;element&quot;][&quot;#attributes&quot;][&quot;id&quot;] == 'edit-keys') {
    $variables['#suffix'] = '&lt;div&gt;Some text&lt;/div&gt;';
  }
}

I've looked into the form-element.html.twig file and it does have a suffix varaible, but it's not rendering.
Any ideas?
/**
 * Implements hook_form_FORM_ID_alter() for login.
 */
function MYTHEME_form_user_login_form_alter(&amp;$form, &amp;$form_state) {
  $form['register_user']['#prefix'] = &quot;&lt;div class=\&quot;form-footer\&quot;&gt; &lt;span&gt;&quot; . t(&quot;Don't have an account?&quot;) . &quot;&lt;/span&gt;&quot;;
  $form['register_user']['#suffix'] = &quot;&lt;/div&gt;&quot;;
}

This is how I've added a wrapper to a form element using prefix and suffix. Hope it helps.