docs: update docs on slots (#1208)

This commit is contained in:
Juro Oravec 2025-05-25 08:53:09 +02:00 committed by GitHub
parent e054a68715
commit 223fc2c68c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 859 additions and 521 deletions

View file

@ -137,7 +137,7 @@ class Calendar(Component):
[`{% component %}`](https://django-components.github.io/django-components/latest/reference/template_tags#component) tag.
- Compose them with [`{% slot %}`](https://django-components.github.io/django-components/latest/reference/template_tags#slot)
and [`{% fill %}`](https://django-components.github.io/django-components/latest/reference/template_tags#fill) tags.
- Vue-like slot system, including [scoped slots](https://django-components.github.io/django-components/latest/concepts/fundamentals/slots/#scoped-slots).
- Vue-like slot system, including [scoped slots](https://django-components.github.io/django-components/latest/concepts/fundamentals/slots/#slot-data).
```django
{% component "Layout"

View file

@ -7,8 +7,8 @@ nav:
- Component defaults: component_defaults.md
- Render API: render_api.md
- Rendering components: rendering_components.md
- Template tag syntax: template_tag_syntax.md
- Slots: slots.md
- Template tag syntax: template_tag_syntax.md
- HTML attributes: html_attributes.md
- Component views and URLs: component_views_urls.md
- HTTP Request: http_request.md

File diff suppressed because it is too large Load diff

View file

@ -189,7 +189,8 @@ which is NOT the same as the `date` variable used inside Calendar's template.
We want to use the same `date` variable that's used inside Calendar's template.
Luckily, django-components allows passing data to the slot, also known as [Scoped slots](../../concepts/fundamentals/slots#scoped-slots).
Luckily, django-components allows [passing data to slots](../../concepts/fundamentals/slots#slot-data),
also known as [Scoped slots](https://vuejs.org/guide/components/slots#scoped-slots).
This consists of two steps:

View file

@ -102,7 +102,7 @@ and render the component inside a template:
!!! info
Component tags should end with `/` if they do not contain any [Slot fills](../../concepts/fundamentals/slots#slot-fills).
Component tags should end with `/` if they do not contain any [Slot fills](../../concepts/fundamentals/slots).
But you can also use `{% endcomponent %}` instead:
```htmldjango