-
Notifications
You must be signed in to change notification settings - Fork 43
Description
📝 Description
According to the docs on dynamic defaults:
You can use the same dynamic attribute patterns in c-vars to apply dynamic defaults to your components.
And from the docs on named slots:
If we want to pass HTML instead of just a string (or another data type) into a component, we can pass them as named slots with the
<c-slot name='...'>...</c-slot>
syntax.
However, when using both together — providing a dynamic default via :label
in <c-vars>
, and supplying a <c-slot name="label">
— the slot content does not override the default as expected.
This seems to contradict the intended behavior, where named slots should allow injecting richer HTML content in place of the default.
💡 Example
In a component template, I define default values like this:
<c-vars
:helper_text="{{ field.help_text|safe }}"
:label="{{ field.label }}{{ field.field.required|yesno:'*,' }}"
field />
Then in usage, I try to override the label with a named slot:
<c-slot name="label">
Start Date
</c-slot>
But the rendered label still comes from the :label
default instead of the slot.
✅ Expected Behavior
When a <c-slot name="label">
is provided, it should take precedence over the :label
defined in <c-vars>
.
🐞 Actual Behavior
The content from :label
is rendered even when a named slot is explicitly declared.