Code snippet that can use to add input format to textarea in drupal 8.
$form['description'] = [
'#type' => 'text_format',
'#format' => 'full_html',
'#title' => $this->t('Description'),
'#default_value' => $config->get('description') ? $config->get('description') : '',
];
the result is like this:
also there are others Properties:
- #base_type: The form element #type to use for the 'value' element. 'textarea' by default.
- #format: (optional) The text format ID to preselect. If omitted, the default format for the current user will be used.
- #allowed_formats: (optional) An array of text format IDs that are available for this element. If omitted, all text formats that the current user has access to will be allowed.