@@ -44,17 +44,17 @@ Example:
4444
4545``` python
4646# my_app/page.py
47- from htmy import html
47+ from htmy import ComponentType, html
4848
49- def page () -> html.div :
49+ def page () -> ComponentType :
5050 return html.div(" Hello, world!" )
5151```
5252
5353``` python
5454# my_app/layout.py
55- from htmy import html
55+ from htmy import ComponentType, html
5656
57- def layout (children : html.div ) -> html.html :
57+ def layout (children : ComponentType ) -> ComponentType :
5858 return html.html(
5959 html.head(html.title(" My App" )),
6060 html.body(children), # <- The html.div page() returns
@@ -69,30 +69,30 @@ Example:
6969
7070``` python
7171# my_app/page.py
72- from htmy import html
72+ from htmy import ComponentType, html
7373
7474def metadata () -> dict[str , str ]:
7575 """ Metadata dependency for the page."""
7676 return {" title" : " My App" }
7777
78- def page () -> html.div :
78+ def page () -> ComponentType :
7979 return html.div(" Hello, world!" )
8080```
8181
8282``` python
8383# my_app/layout.py
84- from htmy import Context, component, html
84+ from htmy import ComponentType, Context, component, html
8585
8686from holm import Metadata
8787
8888@component
89- def head (default_title : str , context : Context) -> html.head :
89+ def head (default_title : str , context : Context) -> ComponentType :
9090 """ Custom head component that can access page metadata from the htmy context."""
9191 metadata = Metadata.from_context(context) # <- The mapping the `metadata` dependency of the page returned
9292 title = metadata.get(" title" , default_title)
9393 return html.head(html.title(title))
9494
95- def layout (children : html.div ) -> html.html :
95+ def layout (children : ComponentType ) -> ComponentType :
9696 return html.html(
9797 head(" My App" ), # <- Our custom head component
9898 html.body(children), # <- The html.div page() returns
0 commit comments