From 60e385f09e5ae614777d580fb684d06c5b01ceba Mon Sep 17 00:00:00 2001 From: adamghill Date: Thu, 25 Jul 2024 09:28:29 -0400 Subject: [PATCH] Add docs for `template_html`. --- docs/source/changelog.md | 4 ++++ docs/source/views.md | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/docs/source/changelog.md b/docs/source/changelog.md index 591f32dd..e3627e57 100644 --- a/docs/source/changelog.md +++ b/docs/source/changelog.md @@ -1,5 +1,9 @@ # Changelog +## 0.61.0 + +- Add [`template_html`](views.md#template_html) to specify inline template HTML on the component. + ## 0.60.0 - Silence warnings about multiple root elements for direct views. diff --git a/docs/source/views.md b/docs/source/views.md index 3a7aa555..8371734f 100644 --- a/docs/source/views.md +++ b/docs/source/views.md @@ -135,6 +135,28 @@ class HelloWorldView(UnicornView): template_name = "unicorn/hello-world.html" ``` +### template_html + +Template HTML can be defined inline on the component instead of using an external HTML file. + +```python +# hello_world.py +from django_unicorn.components import UnicornView + +class HelloWorldView(UnicornView): + template_html = """
+
+ Count: {{ count }} +
+ + + +
+""" + + ... +``` + ## Instance properties ### component_args