From c0c04b32c73ea5b29a76a7023d9a9723d474fe57 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 7 Jul 2025 16:25:55 +0000 Subject: [PATCH] Deployed df7f94cb to dev with MkDocs 1.6.1 and mike 2.1.3 --- dev/getting_started/components_in_templates/index.html | 4 ++-- versions.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/getting_started/components_in_templates/index.html b/dev/getting_started/components_in_templates/index.html index 48b8a4a2..2352b527 100644 --- a/dev/getting_started/components_in_templates/index.html +++ b/dev/getting_started/components_in_templates/index.html @@ -20,7 +20,7 @@ return { "date": "1970-01-01", } -

This will register the component to the default registry. Default registry is loaded into the template by calling {% load component_tags %} inside the template.

Info

Why do we have to register components?

We want to use our component as a template tag ({% ... %}) in Django template.

In Django, template tags are managed by the Library instances. Whenever you include {% load xxx %} in your template, you are loading a Library instance into your template.

ComponentRegistry acts like a router and connects the registered components with the associated Library.

That way, when you include {% load component_tags %} in your template, you are able to "call" components like {% component "calendar" / %}.

ComponentRegistries also make it possible to group and share components as standalone packages. Learn more here.

Note

You can create custom ComponentRegistry instances, which will use different Library instances. In that case you will have to load different libraries depending on which components you want to use:

Example 1 - Using component defined in the default registry

{% load component_tags %}
+

This will register the component to the default registry. Default registry is loaded into the template by calling {% load component_tags %} inside the template.

Info

Why do we have to register components?

We want to use our component as a template tag ({% ... %}) in Django template.

In Django, template tags are managed by the Library instances. Whenever you include {% load xxx %} in your template, you are loading a Library instance into your template.

ComponentRegistry acts like a router and connects the registered components with the associated Library.

That way, when you include {% load component_tags %} in your template, you are able to "call" components like {% component "calendar" / %}.

ComponentRegistries also make it possible to group and share components as standalone packages. Learn more here.

Note

You can create custom ComponentRegistry instances, which will use different Library instances. In that case you will have to load different libraries depending on which components you want to use:

Example 1 - Using component defined in the default registry

{% load component_tags %}
 <div>
   {% component "calendar" / %}
 </div>
@@ -77,4 +77,4 @@
         import myapp.components.calendar
         import myapp.components.table
         ...
-

You can now render the components in templates!


Currently our component always renders the same content. Let's parametrise it, so that our Calendar component is configurable from within the template ➡️

\ No newline at end of file +

You can now render the components in templates!


Currently our component always renders the same content. Let's parametrise it, so that our Calendar component is configurable from within the template ➡️

\ No newline at end of file diff --git a/versions.json b/versions.json index 829958d6..ba99406c 100644 --- a/versions.json +++ b/versions.json @@ -1,7 +1,7 @@ [ { "version": "dev", - "title": "dev (9a4f835)", + "title": "dev (df7f94c)", "aliases": [] }, {