You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# The following directives are currently supported:
141
141
#
142
-
# * `:root_tag_attribute` - A `{name, value}` tuple to apply as an attribute to all root tags during template compilation.
143
-
# Requires that a global `:root_tag_attribute` is configured for the application. The attribute name must be a string and the attribute value must be a string or `true`.
144
-
# May be provided multiple times to apply multiple attributes.
142
+
# * `root_tag_attribute`: A `{key, value}` tuple that will be added as
143
+
# an attribute to all "root tags" of the template during template compilation.
144
+
# See the section on root tags below for more information.
145
+
# * `tag_attribute`: A `{key, value}` tuple that will be added as an attribute to
146
+
# all HTML tags in the template during template compilation.
145
147
#
148
+
# ## Root tags
149
+
#
150
+
# In a HEEx template, all outermost tags are considered "root tags" and are
151
+
# affected by the `root_tag_attribute` directive. If a template uses components,
152
+
# the slots of those components are considered as root tags as well.
153
+
#
154
+
# Here's an example showing which elements would be considered root tags:
155
+
#
156
+
# ```heex
157
+
# <div> <---- root tag
158
+
# <span>Hello</span> <---- not a root tag
159
+
#
160
+
# <.my_component>
161
+
# <p>World</p> <---- root tag
162
+
# </.my_component>
163
+
# </div>
164
+
#
165
+
# <.my_component>
166
+
# <span>World</span> <---- root tag
167
+
#
168
+
# <:a_named_slot>
169
+
# <div> <---- root tag
170
+
# Foo
171
+
# <p>Bar</p> <---- not a root tag
172
+
# </div>
173
+
# </:a_named_slot>
174
+
# </.my_component>
175
+
# ```
146
176
147
177
@typetag::binary()
148
178
@typeattribute::{binary(),Macro.t()}
@@ -151,7 +181,9 @@ defmodule Phoenix.Component.MacroComponent do
0 commit comments