Skip to content

Template variables¤

Here is a list of all variables that are automatically available from inside the component's template and in on_render_before / on_render_after hooks.

is_filled instance-attribute ¤

is_filled: Dict[str, bool]

See source code

Dictonary describing which component slots are filled (True) or are not (False).

New in version 0.70

Use as {{ component_vars.is_filled }}

Example:

{# Render wrapping HTML only if the slot is defined #}
{% if component_vars.is_filled.my_slot %}
    <div class="slot-wrapper">
        {% slot "my_slot" / %}
    </div>
{% endif %}

This is equivalent to checking if a given key is among the slot fills:

class MyTable(Component):
    def get_context_data(self, *args, **kwargs):
        return {
            "my_slot_filled": "my_slot" in self.input.slots
        }