diff --git a/README.md b/README.md
index d49437d6..ed99d2c2 100644
--- a/README.md
+++ b/README.md
@@ -67,6 +67,7 @@ Note: if you need support for Neovim 0.6.x please use the tag `compat/0.6`.
- [x] `swift`
- [x] `tcl`
- [x] `teal`
+ - [x] `templ`
- [x] `terraform`
- [x] `toml`
- [x] `tsx`
diff --git a/queries/templ/context.scm b/queries/templ/context.scm
new file mode 100644
index 00000000..ef4cf0ce
--- /dev/null
+++ b/queries/templ/context.scm
@@ -0,0 +1,22 @@
+; inherits: go,html
+
+([
+ (component_declaration)
+ (script_declaration)
+ (css_declaration)
+ (component_switch_statement)
+ (component_switch_expression_case)
+ (component_switch_default_case)
+] @context)
+
+(component_if_statement
+ consequence: (component_block (_) @context.end)
+) @context
+
+(component_for_statement
+ body: (component_block (_) @context.end)
+) @context
+
+(component_import
+ body: (component_block (_) @context.end)
+) @context
diff --git a/test/test.templ b/test/test.templ
new file mode 100644
index 00000000..60836a5e
--- /dev/null
+++ b/test/test.templ
@@ -0,0 +1,161 @@
+package main
+
+import (
+ "fmt"
+
+
+
+
+
+ "time"
+)
+
+templ headerTemplate(name string) {
+ { name }
+
+
+
+
+
+
+
+
+
+
+
+
+ default:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { "Unknown" }
+ }
+
+
+