Tag formatters
A TagFormatter controls the start/end tag names a component is rendered with. django-components ships these predefined formatters.
Available tag formatters
django_components.component_formatter→ComponentFormatterdjango_components.component_shorthand_formatter→ShorthandComponentFormatter
ComponentFormatter
Bases: django_components.tag_formatter.TagFormatterABC
The original django_component's component tag formatter, it uses the {% component %} and {% endcomponent %} tags, and the component name is given as the first positional arg.
Example as block:
{% component "mycomp" abc=123 %}
{% fill "myfill" %}
...
{% endfill %}
{% endcomponent %}
Example as inlined tag:
{% component "mycomp" abc=123 / %}
ShorthandComponentFormatter
Bases: django_components.tag_formatter.TagFormatterABC
The component tag formatter that uses {% <name> %} / {% end<name> %} tags.
This is similar to django-web-components and django-slippers syntax.
Example as block:
{% mycomp abc=123 %}
{% fill "myfill" %}
...
{% endfill %}
{% endmycomp %}
Example as inlined tag:
{% mycomp abc=123 / %}