How to use #states with a container element?
As it's been mentioned, the #states property doesn't work for fieldsets, containers.
You need some JS here, e.g:

The form

$form['promo_code_trigger'] = [
  '#type' =&gt; 'container',
  '#attributes' =&gt; ['id' =&gt; ['promo-code-add-el']],
  'data' =&gt; [
    '#markup' =&gt; t('Add promotional code'),
  ]
];

$form['promo_code_wrapper'] = [
  '#type' =&gt; 'container',
  '#attributes' =&gt; [
    'id' =&gt; ['promo-code-add-el-triggered'],
    'class' =&gt; ['hidden'],
  ],
];


JS

$("#promo-code-add-el").on("click", function (e) {
  $('#' + e.target.id + "-triggered").toggleClass('hidden');
  $('#' + e.target.id).toggleClass('active');
});