Drupal 10: Adding Classes To Form Element Wrapper

$form['name'] = [
  '#type' => 'textfield',
  '#title' => $this->t('Name'),
  '#wrapper_attributes' => [
    'class' => [

This creates the following HTML.

<div class="wrapper-class">
  <label for="edit-name">Name</label>
  <input class="form-text" type="text" id="edit-name" name="name" value="test">


Add new comment

The content of this field is kept private and will not be shown publicly.
5 + 11 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.