Skip to main content

Django-native component development environment for building design systems

Project description

Django Showroom

A Django-native component development environment for building design systems. Develop, document, and test atomic UI components in isolation – with multi-framework rendering, shared story contracts, and side-by-side comparison.

Django Showroom demo

Why this project

Most teams with Django + frontend islands struggle with two recurring issues:

  1. Story drift across rendering frameworks.
  2. Styling drift across implementations.

This architecture solves both by making contracts and styling framework-agnostic first, then implementing thin adapters.

Installation

pip install django-showroom

Then add it to your Django project:

# settings.py
INSTALLED_APPS = [
    ...
    "django_cotton",
    "showroom",
]
# urls.py
from django.urls import include, path

urlpatterns = [
    path("showroom/", include("showroom.urls")),
]

You'll also need Node.js (>=20) for the build step:

npm install
npm run build

Then start your Django dev server and open /showroom/.

How it differs from Storybook.js

Django Showroom storybook-django (Torchbox)
Architecture Django-native – single server Storybook.js wrapper – requires Django + Node servers
Story format JSON contracts (component.json, stories.json) JavaScript CSF (Component Story Format)
Multi-framework Cotton, React, Alpine, HTML, vanilla JS – simultaneously Django templates only (rendered via API)
Split view Built-in side-by-side framework comparison Not available
Design tokens Built-in recipe engine for variants and CSS tokens External (BYO)
Focus Atomic design system components Template previews

Adding components

Create a new directory under components/cotton/ds/your_component/ with:

your_component/
├── component.json            # Metadata (slug, label, adapter paths)
├── stories.json              # Story definitions with defaults
├── stories/
│   ├── controls.json         # Control field definitions
│   ├── default.html          # Django/Cotton story template
│   └── react.preview.ts      # React story renderer (optional)
└── index.html                # Cotton component template

Then run npm run build to validate and regenerate the registry.

Example components

The repo ships with 3 example components demonstrating a complexity gradient:

  • Button – simple, static component with variant/size controls
  • Badge – medium complexity with data-attribute-driven styling
  • Text Field – complex form input with label, icons, error states

Each component includes a component.json contract, stories, controls, a Cotton template, and a React preview – showing how one story definition renders identically across frameworks.

Development setup

python3 -m venv .venv
source .venv/bin/activate
pip3 install -e ".[dev]"
npm install
npm run build
python3 manage.py runserver

Open: http://127.0.0.1:8000/showroom/

Docs

License

MIT

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_showroom-0.1.0a1.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_showroom-0.1.0a1-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file django_showroom-0.1.0a1.tar.gz.

File metadata

  • Download URL: django_showroom-0.1.0a1.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for django_showroom-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 ca83c3aec55b6affe0c3f33b794a61b74d35c09ad5fe056801465ff5a6a9d806
MD5 65235083d454b7c93ebf00ab7c1eafe3
BLAKE2b-256 9a9b950b95cddac2f85d258156fe8cffe395d760b2b2a0048430035380e3f12d

See more details on using hashes here.

File details

Details for the file django_showroom-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_showroom-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5b599d52442a74e224bb1c3b2713c0de3ffe1f55eb6b41940aa9a67863dc6f5
MD5 b546da6b9b31e7c40d1d89c7c3440b66
BLAKE2b-256 dbda4e21cc6c9007d7510f35735939666b40886f8a0273eba38a03bb8f94a69c

See more details on using hashes here.

Supported by

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