How to alter file upload description text I'm trying to customize text for a file upload widget in Drupal 8.

Here is a screenshot of the widget:



I just want to display the first 15 MB which I added as file field description text in the content type.

The trouble is the last 3 lines of text have no HTML tags so I can't selectively hide it with display:none;. Here is what I mean:



I tried this CSS but it doesn't work:

#edit-field-dataset-file-0--description * {
    display:none;
}

#edit-field-dataset-file-0--description p {
    display:inline !important;
}


Does anyone have any suggestions?
I used hook_field_widget_form_alter as suggested by DannyEnglander and leymannx.

8.8.x hook_field_widget_form_alter

Replace MYMODULE with your custom module's name and alter the element array to suit your needs.

/**
 * Implements hook_field_widget_form_alter().
 */
function MYMODULE_field_widget_form_alter(&amp;$element, \Drupal\Core\Form\FormStateInterface $form_state, $context) {
  if (get_class($context['widget']) === 'Drupal\file\Plugin\Field\FieldWidget\FileWidget' &amp;&amp; !empty($context['form']['#attributes'])) {
    $element['#description'] = '&lt;p&gt;File must be less than &lt;strong&gt;15 MB&lt;/strong&gt;.&lt;br/&gt;Allowed types: &lt;code&gt;txt csv tsv xls xlsx sav sas7bdat&lt;/code&gt;&lt;/p&gt;';
  }
}