When you render a widget, you can add class with name foo, like this:
{{ form_widget(form.name, {'attr': {'class': 'foo'}}) }}
If you want to add class foo to form element (tag), then you can use the same syntax:
{{ form(form, { 'attr': {'class': 'foo'} }) }}
Check out official documentation.