Skip to main content

Django widgets styled with Material Components for the Web.

Project description

Easily convert your Django Forms and ModelForms to use widgets styled with Material Components for the Web.

status docs pypi pyversion license

Click to view demo

Quick Start

  1. Install Django Material Widgets:

    pip install django-material-widgets
  2. Add material_widgets to INSTALLED_APPS in your

  3. Edit your

    • Import material_widgets.widgets.MaterialForm and/or material_widgets.widgets.MaterialModelForm:

      from material_widgets import MaterialForm, MaterialModelForm
    • Change forms using django.forms.Form and/or django.forms.ModelForm to MaterialForm or MaterialModelForm respectively:

      class MyForm(forms.Form): ⇨ class MyForm(MaterialForm):
      class MyModelForm(forms.ModelForm): ⇨ class MyModelForm(MaterialModelForm):
  4. Edit your HTML templates:

    • Change {{ form }} template variables to {{ form.as_components }}:

      {{ form.as_p }} ⇨ {{ form.as_components }}
    • Add {{ }} to your <head> tag:

          {{ }}
    • Add the mdc-typography CSS class to your <body> tag:

      <body class="mdc-typography">
    • Add {{ }} to the bottom of your <body> tag:

      <body class="mdc-typography">
          {{ }}
    • (Optional) Add stylesheet links:

          <link rel="stylesheet" href=",400,500">
          <link rel="stylesheet" href="">


To view the demo locally at http://localhost:8000:

git clone
cd django_material_widgets/src
python migrate --settings=demo.settings
python runserver --settings=demo.settings


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-material-widgets-1.0.0b3.tar.gz (452.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page