Have you considered html like components? #444
SebastianStehle
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
Not a stupid question at all, when we designed the templ element expression syntax we did consider a syntax such as what you have suggested. This is the syntax we landed on: https://templ.guide/syntax-and-usage/template-composition The reason we went with this over something more familiar to HTML, was to reduce the complexity of the implementation, and make the interaction with the go lsp easier (because it looks like a go function it's much easier for the auto complete in IDEs to work. Hopefully this explanation helps you understand the thought process a bit! |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am new to golang and templ, so I am sorry if I am ask something stupid.
In many other platforms components look like normal html components, e.g. react, razor (c#), web components and so on. I was thinking how to use a css component library or tailwind with templ and ideally I would create custom components to only have a single definition of a button.
But the current syntax for that is very noisy. So my proposal would be to introduce xhtml like components. My example is from this issue: #229
Summary:
component
prefix.About the naming of components
I guess it might be tricky to find out if a component is actually a native HTML component or custom component. An easy solution would be to prefix the components with the package name:
<app:button />
It could also be helpful to be able to override the existing HTML buttons, but there are also arguments against that.
Beta Was this translation helpful? Give feedback.
All reactions