Skip to main content
Test Status:
GitHub Workflow Status
Version Info:
PyPI PyPI - Downloads
Compatibility:
https://img.shields.io/pypi/pyversions/django-component-tags-tailwindcss?style=flat-square&label=Python%20Versions PyPI - Django Version

Tailwindcss component tags for Django Projects.

Description

Django template tags based on Tailwindcss, created with django-component-tags.

Tailwind is an utility-first CSS framework packed with classes like flex, pt-4, text-center and rotate-90 that can be composed to build any design, directly in your markup.

Requirements

Requires Django 2.2 or newer, and is tested against Python 3.7 and PyPy.

Quick Start

Install the python package django-component-tags-tailwindcss from pip:

pip install django-component-tags-tailwindcss

Add it to INSTALLED_APPS in your settings.py:

INSTALLED_APPS = [
    ...
    'component_tags',
    'component_tags_tailwindcss',
    ...
]
...

Next, create your own base template:

# templates/index.html
{% load static %}
{% load tailwindcss_component_tags %}
<!DOCTYPE html>
<html lang="en">
{% block head %}
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>-----</title>
        <!-- Styles -->
        <link rel="stylesheet" href="{% static 'component_tags_tailwindcss/css/tailwind.min.css' %}">
        {% components_css %}
    </head>
{% endblock head %}
<body>
{% block content %}{% endblock content %}
<!-- Scripts -->
{% components_js %}
</body>
</html>

After loading the tailwindcss_component_tags library you will be able to use any of the available components inside any template.

Optional: You can use the provided base template for a quick setup from component_tags_tailwindcss/base.html:

# templates/index.html
{% extends 'component_tags_tailwindcss/base.html' %}
{% load tailwindcss_component_tags %}

{% block content %}
    Content goes here...
{% endblock content %}

We encourage you to make your own installation of Tailwindcss, do not use this base template on production environments.

Components

  • Link

  • Alert*

  • Breadcrumb

  • Button

  • Card

  • Dropdown*

  • Label

  • Modal*

Some components marked with * require javascript, therefore i choose AlpineJS to make the minimal javascript logic.

You can of course extend this components and implement your own javascript framework.

Examples

Here we have just a couple of examples to showcase the code. Checkout this template if you want to get more examples.

Alert

# templates/index.html
{% extends 'component_tags_tailwindcss/base.html' %}
{% load tailwindcss_component_tags %}

{% block content %}
    {% alert %}Link 1{% endalert %}
    {% alert color="primary" %}Primary link{% endalert %}
    {% alert color="danger" %}Secondary Link{% endalert %}
{% endblock %}

Card

# templates/index.html
{% extends 'component_tags_tailwindcss/base.html' %}
{% load tailwindcss_component_tags %}

{% block content %}
    {% card %}
        {% slot 'header' %}
            <img class="w-full"
                 src="https://images.unsplash.com/photo-1593642634524-b40b5baae6bb?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2089&q=80"
                 alt="card-logo">
        {% endslot %}
        Card body
    {% endcard %}
{% endblock %}

Note

This project has been set up using PyScaffold 4.0rc2. For details and usage information on PyScaffold see https://pyscaffold.org/.

Release files for django-component-tags-tailwindcss 0.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 django-component-tags-tailwindcss 0.0.3
File Size Uploaded
django_component_tags_tailwindcss-0.0.3.tar.gz 3.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-component-tags-tailwindcss 0.0.3
File Interpreter ABI Platform
django_component_tags_tailwindcss-0.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 6.1 MB

Release files / django_component_tags_tailwindcss-0.0.3.tar.gz

Download URL django_component_tags_tailwindcss-0.0.3.tar.gz
Size 3.3 MB
Tags Source
SHA-256 checksum
How to use checksums
5c24d7d7858f2fab199e28ea8478fac884079dee78e37a7bd9f2f3086bfa8206
BLAKE2b-256 checksum
How to use checksums
f91cee9fde8352b88284a761bc99ba337bb36a079282e9fc675fba872f6ef57a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release files / django_component_tags_tailwindcss-0.0.3-py2.py3-none-any.whl

Download URL django_component_tags_tailwindcss-0.0.3-py2.py3-none-any.whl
Size 2.8 MB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4f284f4c8c18f89a89bcb0ef69bc124f36160156413a697722d960860320d0b8
BLAKE2b-256 checksum
How to use checksums
c6c846ce97d2484f6562102ff8c9af264cd0fff3682e26e3e3858058d21c35a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

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