Calendar Heatmap
Style-agnostic SVG calendar heatmap (GitHub contribution style).
Preview
Arguments
calendar_heatmap(data={'2026-01-02': 1, '2026-01-03': 3, '2026-01-05': 5, '2026-01-06': 8, '2026-01-07': 2, '2026-01-09': 4, '2026-01-10': 11, '2026-01-11': 6, '2026-01-12': 1, '2026-01-14': 2, '2026-01-15': 7, '2026-01-16': 9, '2026-01-17': 3, '2026-01-19': 1, '2026-01-20': 5, '2026-01-21': 12, '2026-01-22': 8, '2026-01-23': 4, '2026-01-25': 2, '2026-01-26': 6, '2026-01-27': 10, '2026-01-28': 3, '2026-01-29': 1, '2026-01-31': 7}, year=2026, title='Contributions')Usage
views.py
python
from djust import LiveView
from djust.components import CalendarHeatmap
class MyView(LiveView):
template_name = "my_template.html"
def mount(self, request, **kwargs):
self.component = CalendarHeatmap(data={'2026-01-02': 1, '2026-01-03': 3, '2026-01-05': 5, '2026-01-06': 8, '2026-01-07': 2, '2026-01-09': 4, '2026-01-10': 11, '2026-01-11': 6, '2026-01-12': 1, '2026-01-14': 2, '2026-01-15': 7, '2026-01-16': 9, '2026-01-17': 3, '2026-01-19': 1, '2026-01-20': 5, '2026-01-21': 12, '2026-01-22': 8, '2026-01-23': 4, '2026-01-25': 2, '2026-01-26': 6, '2026-01-27': 10, '2026-01-28': 3, '2026-01-29': 1, '2026-01-31': 7}, year=2026, title='Contributions')my_template.html
django
{{ component }}Parameters
| Name | Type | Default |
|---|---|---|
| data | dict | None | None |
| year | int | None | None |
| title | str | None | None |
| color_empty | str | '#ebedf0' |
| color_min | str | '#9be9a8' |
| color_max | str | '#216e39' |
| cell_size | int | 12 |
| cell_gap | int | 2 |
| show_month_labels | bool | True |
| show_day_labels | bool | True |
| custom_class | str | '' |
| **kwargs | — passed to `Component.__init__`: `name=` identifies the instance in the events it sends, `id=` sets `component.id`, and any other keyword is kept as state | — |
Source & styles
| File | Path | Notes |
|---|---|---|
| module | djust.components.components.calendar_heatmap | Subclass it, or pass custom_class, to change how it renders. |
| css | djust_components/components.css | Defines 6 of this component's classes at line 2062, 2063, 2064, 2065, 2067. Override those rules, or the custom properties they read, in a stylesheet loaded after it. |