{% extends "djust_theming/catalogue/base.html" %} {% load theme_tags theme_components djust_components %} {% block title %}{{ display_name }} — Components{% endblock %} {% block catalogue_content_class %}dc-content--with-rail{% endblock %} {% block catalogue_content %}
{% theme_breadcrumb items=crumbs %}

{{ display_name }}

{% if description %}

{{ description }}

{% endif %}
{% theme_badge component_type variant=component_type %} {% if component_type == "template" %} {{ required_context|length }} required {{ optional_context|length }} optional {{ available_slots|length }} slot{{ available_slots|length|pluralize }} {{ accessibility|length }} a11y rule{{ accessibility|length|pluralize }} {% elif python_params %} {{ python_params|length }} param{{ python_params|length|pluralize }} {% endif %}
{% comment %} This page renders a component on a live server; the reference entry is the same component written down, generated from the same registry and pinned to whatever djust version the docs site builds from. Link both ways so a reader never has to guess which one they are looking at. {% endcomment %} {% comment %} ===== Preview — one bound component (ADR-032) ===== `{{ preview }}` is the only read of the component on this page, so an event that changes only its state (a playground chip, an accordion toggle) patches the preview's subtree instead of re-rendering the page. Keep it the bare variable. {% endcomment %} {{ preview }}
{% card title="Usage" %} {% comment %} The two-file example a developer actually writes: the LiveView that owns the component and the template line that renders it (`_usage_snippet`). {% endcomment %}
views.py
{{ usage_html.view }}
my_template.html
{{ usage_html.template }} {% if events %}

Events this component sends to the view: {% for ev in events %}{{ ev }}{% if not forloop.last %}, {% endif %}{% endfor %}.

{% endif %} {% endcard %}
{% if props_rows %}
{% card title="Props" %} {% theme_table headers=props_headers rows=props_rows class="dc-props" %} {% endcard %}
{% elif params_rows %}
{% card title="Parameters" %} {% theme_table headers=params_headers rows=params_rows class="dc-props" %} {% endcard %}
{% endif %} {% if a11y_rows %}
{% card title="Accessibility" %} {% theme_table headers=a11y_headers rows=a11y_rows %} {% endcard %}
{% endif %} {% if available_slots %}
{% card title="Slots" %}
{% for slot in available_slots %}{% theme_badge slot variant="secondary" %}{% endfor %}
{% endcard %}
{% endif %} {% comment %} Collapsed by default: the paths to override and the template source are for the reader who has decided to change the component, not the one choosing it. A native `details` — the framework has no block-form collapsible yet. {% endcomment %}
Source & styles {% card %} {% theme_table headers=styles_headers rows=styles_rows %} {% if css_variables %}
CSS variables
{% for var in css_variables %}{% theme_badge var variant="secondary" %}{% endfor %}
{% endif %} {% if template_source %}
Template source — {{ name }}.html
{{ template_source_html }} {% endif %} {% endcard %}
{% endblock %}