diff --git a/docs/docs/04-core-concepts/01-components.md b/docs/docs/04-core-concepts/01-components.md index 8c49e026d..2d41b321b 100644 --- a/docs/docs/04-core-concepts/01-components.md +++ b/docs/docs/04-core-concepts/01-components.md @@ -57,3 +57,31 @@ func main() { This code is unsafe! In code-only components, you're responsible for escaping the HTML content yourself, e.g. with the `templ.EscapeString` function. ::: +## Method components + +templ components can be returned from methods (functions attached to types). + +Go code: + +``` +package main + +type Data struct { + message string +} + +templ (d Data) Method() { +