A Django-native component framework with props, state, HTMX, and Alpine.js
Project description
Shrd
A Django-native component framework for building UI with props, server state, slots, and scoped styles — using only the Django ecosystem plus bundled HTMX and Alpine.js.
pip install shrd
Shrd is a framework, not a drop-in library. Your Django project adopts its conventions: components live in your apps, templates sit beside scoped CSS, and HTMX carries server actions.
Philosophy
Shrd does not ship a widget catalog. It gives you a small, familiar model — closer to React/Vue than to Django templates alone — without a build step or SPA complexity:
- Props — typed inputs declared on a Python class
- State — server-owned data updated via
@actionmethods - Slots — wrap and compose markup like
children/ default slots - Scoped styles — co-located
.cssfiles, automatically prefixed to the component - Computed — derived values via
@computedmethods - Events — HTMX custom events via
@emitsandActionResult - HTMX — partial re-renders after actions
- Alpine.js — optional client-side behavior inside templates
- View data — optional structured layouts, mutable via
ViewTreeComponent
Quick start
# myapp/components.py
from shard import Component, Prop, action
class Card(Component):
title = Prop(str, default="")
template_name = "components/card.html"
{% load shard %}
{% shard_scripts %}
{% component Card title="Profile" %}
<p>Anything here is passed through the default slot.</p>
{% endcomponent %}
See the quickstart guide for a full walkthrough.
Documentation
| Topic | Link |
|---|---|
| Installation | getting-started/installation |
| Components | concepts/components |
| Slots | concepts/slots |
| Scoped styles | concepts/styles |
| Actions & HTMX | interactivity/actions |
| HTMX & Alpine | guides/htmx-and-alpine |
| View data | guides/view-data |
| API reference | reference/api |
| Examples | examples |
| Roadmap | roadmap |
| Security | security |
Example app
pip install shrd[dev]
cd example
python manage.py migrate
python manage.py runserver
Or install from source:
pip install -e ".[dev]"
cd example
python manage.py migrate
python manage.py runserver
Development
pip install -e ".[dev]"
pre-commit install
python -m pytest tests/ -q
python manage.py shard_report # framework size / page-load weight
96 tests with ≥90% coverage. CI runs pre-commit, Ruff, tests (Python 3.10–3.12), and docs build on every PR.
pre-commit run --all-files # lint + format locally
pip install -e ".[docs]"
python -m mkdocs serve
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shrd-0.3.1.tar.gz.
File metadata
- Download URL: shrd-0.3.1.tar.gz
- Upload date:
- Size: 66.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7ade134cd6380e32f8736e73035874dee5be8c691675d8a6a805c6f93df5789
|
|
| MD5 |
f480718da30fff2d2a79ed1bbfe3d162
|
|
| BLAKE2b-256 |
4c3a156565a9df6a205466008d44896179eb72df6281af10f4db2a75a766a799
|
Provenance
The following attestation bundles were made for shrd-0.3.1.tar.gz:
Publisher:
workflow.yml on kurtisrogers/Shard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shrd-0.3.1.tar.gz -
Subject digest:
c7ade134cd6380e32f8736e73035874dee5be8c691675d8a6a805c6f93df5789 - Sigstore transparency entry: 2147113701
- Sigstore integration time:
-
Permalink:
kurtisrogers/Shard@749658202e803442b04a9f6ccdbcc96cf9d46fa5 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/kurtisrogers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@749658202e803442b04a9f6ccdbcc96cf9d46fa5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file shrd-0.3.1-py3-none-any.whl.
File metadata
- Download URL: shrd-0.3.1-py3-none-any.whl
- Upload date:
- Size: 64.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97498ebf19f621ee27e277bc913a3992f04b3c60243db61e307e548c002760cd
|
|
| MD5 |
9607ec17df0748cc4546d253b22096b9
|
|
| BLAKE2b-256 |
be9a8c6ac1402e55d41e8dfb6db125557f38c1f7478ae801796bfec5425306b3
|
Provenance
The following attestation bundles were made for shrd-0.3.1-py3-none-any.whl:
Publisher:
workflow.yml on kurtisrogers/Shard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shrd-0.3.1-py3-none-any.whl -
Subject digest:
97498ebf19f621ee27e277bc913a3992f04b3c60243db61e307e548c002760cd - Sigstore transparency entry: 2147114093
- Sigstore integration time:
-
Permalink:
kurtisrogers/Shard@749658202e803442b04a9f6ccdbcc96cf9d46fa5 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/kurtisrogers
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@749658202e803442b04a9f6ccdbcc96cf9d46fa5 -
Trigger Event:
push
-
Statement type: