How to add field content as class in Twig? I want to add the content of a field (i.e. "workshop") as a class in field-html.twig 

i tried 

{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
    'icon-' ~ item.content,
  ]
%}


but it only shows "icon-" as a class.
item.content works only in the items loop, but don't try to put rendered output in a class name. Use the field value instead, which you can get through the field object #items stored in a field template inside of the variable element:

{{ element['#items'].value }}


or from a different field of the parent entity:

{{ element['#object'].field_example.value }}


Depending on the field type replace .value with a different property, for example for a reference field to get the target id or the label of the target with .target_id or .entity.label.

When you have found the field value build your class name:

{%
  set classes = [
    ...
    'icon-' ~ element['#items'].value|clean_class,
  ]
%}