     field_html = attach_addon(field_html, field)
 
     tags = [label_html, field_html]
-      |> attach_error(form, field)
+    |> attach_error(form, field)
 
     wrapper_class = ["form-group"]
-      |> attach_error_class(form, field)
+    |> attach_error_class(form, field)
+    |> attach_required_class(field)
 
     content_tag(:div, tags, class: Enum.join(wrapper_class, " "))
 


  defp attach_error_class(wrapper_class, form, field) do
    if form.phoenix_form.errors[field.name] do
      ["has-error" | wrapper_class]
    else
      wrapper_class
    end

    data = field.data
    phoenix_opts = if opts[:phoenix_opts], do: opts[:phoenix_opts], else: []

    class = if opts[:class], do: opts[:class], else: ""

    args = [form.phoenix_form, field.name]
    args = args ++ cond do
