Templates are hygienic by default, so `props` is unknown to `children`, see <https://nim-lang.org/docs/manual.html#templates-identifier-construction>
I changed a few things to make your example compile without importing `htmlElements`, most importantly note the `props {.inject.}`: template html*(name: untyped, children: untyped) = proc `name`*(): string = result = "<html>" & `children` & "</html>" template h1*(children: untyped): string = "<h1>" & `children` & "</h1>" template component*[T](name: untyped, children: untyped) = template `name`*(props {.inject.}: T): string = `children` type MyProp = object text: string component[MyProp](MyComponent): h1: props.text html app: MyComponent(MyProp(text: "HELLO WORLD")) echo app() # <html><h1>HELLO WORLD</h1></html> Run