# {% interlace %} Tag

Include and render Interlace components in Django templates with automatic property passing and lifecycle management.

## Basic usage

Load the template tags:

```django
{% load interlace %}
```

Include a component:

```django
{% interlace "ComponentName" %}
```

## Passing properties

Pass data as keyword arguments:

```django
{% interlace "UserCard"
    title="Welcome"
    count=42
    is_active=True
    username=user.username %}
```

- Literal values: strings, numbers, booleans
- Template variables: `user.username`, `post.title`
- Complex types: Django model instances, querysets

## Django model instances

Pass full model objects directly:

```django
{% interlace "UserProfile" person=request.user %}
```

In your component, type hint for autocomplete:

```python
from django.contrib.auth.models import User
from interlace import Component

class UserProfile(Component):
    person: User = None

    def inline_template(self):
        return """
        <div>
            <h2>{{ person.username }}</h2>
            <p>{{ person.email }}</p>
        </div>
        """
```

## Components in loops

Use `key` for efficient rendering:

```django
{% for post in posts %}
    {% interlace "BlogPost" key=post.id post=post %}
{% endfor %}
```

> **Reserved Names**
> Avoid `user` as a component prop name - conflicts with Django's `request.user`.
> Use `person`, `profile`, or `account` instead.
