A library to create simple reusable template components in Django. Current version is 0.149.0, with active development and frequent releases (multiple per month). It supports Django 4.2+ and Python 3.10+. Key features include component slots, dynamic CSS/JS, and component nesting.
pip install django-componentsVerified import paths — ran on the pinned version, not inferred.
Define a simple component and render it in a Django template using the component_tags library.
Set django.template.backends.django.TEMPLATES loaders to cached.Loader only if you understand the caching; use FileSystemLoader for development.
Migrate defaults to Kwargs: class Kwargs: show_details: bool = True
Use Python 3.10+ and Django 4.2+ or 5.0+.
Update any JavaScript code referencing `window.Components` to `window.DjangoComponents`.
Add 'django_components' to INSTALLED_APPS in settings.py and run python manage.py migrate.
Register the component with @register('name') or use {% component 'name' / %} syntax after version 0.140.Upgrade to latest: pip install -U django-components; use from django_components import Component.