I have programmatically added #states into fields in a paragraph works fine for existing fields in a form. But on clicking add more button on paragraph to add more fields the hidden fields show up. I tried this Patch but it didn’t work for me.
I have used this hook to alter the field to add #states.
function mymodule_field_widget_entity_reference_paragraphs_form_alter(&$element, &$form_state, $context) { $element['subform']['field_title']['#states'] = [ 'invisible' => [ '#edit-parent-field-0-subform-parent-field-content-'.$element['#delta'].'-subform-target-field-wrapper select' => ['value' => 'value'] ] ]; }