# Globally set attrs for form templates

**URL:** <https://forum.djangoproject.com/t/globally-set-attrs-for-form-templates/23111>\
**Category:** Templates & Frontend\
**Created:** [August 16, 2023, 1:29pm UTC](https://forum.djangoproject.com/t/globally-set-attrs-for-form-templates/23111 "2023-08-16T13:29:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vazark](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/vazark/32/5827_2.png) [@vazark](https://forum.djangoproject.com/u/vazark)\
**Post date:** [August 16, 2023, 1:29pm UTC](https://forum.djangoproject.com/t/globally-set-attrs-for-form-templates/23111/1 "2023-08-16T13:29:04Z")

</div>

I’m looking for something like [this](https://django-crispy-forms.readthedocs.io/en/latest/crispy_tag_forms.html#change-crispy-forms-input-default-classes) but natively in Django.

Is there any way to globally define the CSS classes associated with a widget? Or do I need to subclass each widget and use them instead?

_Context_: Currently, I’m using crispy forms for form styling but it requires to be tied to a CSS library. Most of my site is tailwind + some handwritten CSS. Just looking to see if I need to build a custom implementation (or crispy-tailwind) or if I need to get off of crispy-forms

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 16, 2023, 6:42pm UTC](https://forum.djangoproject.com/t/globally-set-attrs-for-form-templates/23111/2 "2023-08-16T18:42:43Z")

</div>

If its different classes per widget that you’re looking for, then yes - custom widgets would seem to be the way to go.

But if it’s the same classes that you want to apply to every widget, then you might be able to subclass the Crispy [`field`](https://django-crispy-forms.readthedocs.io/en/latest/api_layout.html#layout.Field) object and use it for all the form fields.
