Build reusable components for Django. No Python required.
Compose UI from single template files. No build step, fully interoperable with the Django templates you already write.
1. Define a component
2. Use it like a tag
3. Renders to
Pricing
Simple, per-seat billing.
Support
Help when you need it.
1. Define a component
2. Props change the output
3. Renders to
1. Define a component
2. One prop, many looks
3. Renders to
New to components? Start with Thinking in Components.
Why cotton?
Rapid UI composition
Create reusable UI components from a single HTML file, no Python required. Composing from small, modular pieces streamlines your workflow and boosts productivity.
Style it your way
Components own their markup, so you can style them however you like: plain CSS, your design system or utility frameworks like Tailwind.
{%
Interoperable with Django Templates
Cotton enhances Django templates without replacing them, allowing progressive enhancement while maintaining full use of existing template features.
Enhanced Productivity
Cotton's optional HTML tag-like syntax allows code editors to recognize its components as HTML elements, enabling features like syntax highlighting and automatic tag completion.
Minimal Overhead
Cotton compiles to native Django template tags and caches the result, so it adds virtually no runtime overhead.
Plays well with HTMX and Alpine
Components are just templates, so they drop straight into HTMX swaps and pair naturally with Alpine.js for rich, server-driven interactivity.
Why not just Django templates?
You still can, and Cotton stays fully interoperable with them. But the native tools for reuse get verbose fast. Here is the same idea, the native way and with Cotton.