How do I correctly use states?
/**
 * Implements hook_form_FORM_ID_alter().
 */
function MYTHEME_form_user_register_form_alter(&amp;$form, FormStateInterface $form_state) {
  // If your field is link field
  $form['the_field']['widget'][0]['uri']['#states'] = [
    // Only make the field 'the_field' as required when the 'field_of_type_radio' value is equal to '1'.
    'required' =&gt; [
      ':input[name="field_of_type_radio"]' =&gt; ['value' =&gt; '1'],
    ],
  ];
  // If your field is text field
  $form['the_field']['#states'] = [
    // Only make the field 'the_field' as required when the 'field_of_type_radio' value is equal to '1'.
    'required' =&gt; [
      ':input[name="field_of_type_radio"]' =&gt; ['value' =&gt; '1'],
    ],
  ];
}