Skip to main content

Crispy-Tailwind

https://img.shields.io/badge/code%20style-black-000000.svg

A Tailwind CSS template pack for the wonderful django-crispy-forms.

WARNING

This project is still in its early stages of development. Any contributions to the package would be very welcomed.

Currently the template pack allows the use of the |crispy filter to style your form. Here is an example image.

https://django-crispy-forms.github.io/crispy-tailwind/_images/crispy_form.png

How to install

Install via pip.

pip install crispy-tailwind

You will need to update your project’s settings file to add crispy_forms and crispy_tailwind to your project’s INSTALLED_APPS setting. Also set tailwind as an allowed template pack and as the default template pack for your project:

INSTALLED_APPS = (
    ...
    "crispy_forms",
    "crispy_tailwind",
    ...
)

CRISPY_ALLOWED_TEMPLATE_PACKS = "tailwind"

CRISPY_TEMPLATE_PACK = "tailwind"

How to use

This project is still in its early stages.

Current functionality allows the |crispy filter to be used to style your form. In your template:

  1. Load the filter: {% load tailwind_filters %}

  2. Apply the crispy filter: {{ form|crispy }}

We can also use the {% crispy %} tag to allow usage of crispy-forms’ FormHelper and Layout. In your template:

  1. Load the crispy tag: {% load crispy_forms_tags %}

  2. Add FormHelper to your form and use crispy-forms to set-up your form

  3. Use the crispy tag {% crispy form %} in your template

Documentation

The documentation for this project is available here: https://django-crispy-forms.github.io/crispy-tailwind/index.html

FAQs

What about custom widgets?

The template pack includes default styles for widgets included in Django itself. Styling of widget instances can be done by using the widget.attrs argument when creating the widget.

For example the following form will render <input type="text" name="name" class="customtextwidget custom-css" required id="id_name">:

class CustomTextWidget(forms.TextInput):
    pass

class CustomTextWidgetForm(forms.Form):
    name = forms.CharField(
        widget=CustomTextWidget(attrs={"class": "custom-css"})
    )

Release files for crispy-tailwind 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crispy-tailwind 1.0.3
File Size Uploaded
crispy-tailwind-1.0.3.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crispy-tailwind 1.0.3
File Interpreter ABI Platform
crispy_tailwind-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 kB

Release files / crispy-tailwind-1.0.3.tar.gz

Download URL crispy-tailwind-1.0.3.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2bc9f616d406e4b003f25d46fcb0079f1c2522719d97adb107667271d849459a
BLAKE2b-256 checksum
How to use checksums
aeaca307ae5ce869d7151b90d4b8b042a48eb454a936dacc695f6418486e5bd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release files / crispy_tailwind-1.0.3-py3-none-any.whl

Download URL crispy_tailwind-1.0.3-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31427f66b1c4fd0d6fb040f4197cfb97d104cdbe7641ea2dea940c0057c4db4b
BLAKE2b-256 checksum
How to use checksums
c9ca11f65e24f3c182dfaf90fd3710d2dcca0fbc3026923e47b43f52a4a2349b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.8

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page