From 82f6923a21cf68aeafa8fa5905863e1fa15cc5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 18 Jan 2022 14:35:05 +0100 Subject: [PATCH] [DOC] add more information to the slots page --- doc/reference/slots.md | 231 ++++++++++++++++++++++++++++--------- doc/reference/templates.md | 20 ++-- 2 files changed, 189 insertions(+), 62 deletions(-) diff --git a/doc/reference/slots.md b/doc/reference/slots.md index ccc0d01a..f687d4d7 100644 --- a/doc/reference/slots.md +++ b/doc/reference/slots.md @@ -3,68 +3,89 @@ ## Content - [Overview](#overview) -- [Example](#example) -- [Reference](#reference) +- [Named slots](#named-slots) +- [Rendering Context](#rendering-context) +- [Default Slot](#default-slot) +- [Default Content](#default-content) +- [Dynamic slots](#dynamic-slots) +- [Slots and props](#slots-and-props) +- [Slot params](#slot-params) +- [Slot scopes](#slot-scopes) ## Overview Owl is a template based component system. There is therefore a need to be able -to make generic components. For example, imagine a generic `Dialog` -component, which is able to display some arbitrary content. - -Obviously, we want to use this component everywhere in our application, to -display various different content. The `Dialog` component is technically the -owner of its content, but is only a container. The user of the `Dialog` is -the component that want to _inject_ something inside the `Dialog`. This is -exactly what slots are for. - -## Example - -To make generic components, it is useful to be able for a parent component to _inject_ -some sub template, but still be the owner. For example, a generic dialog component -will need to render some content, some footer, but with the parent as the -rendering context. - -Slots are inserted with the `t-slot` directive: +to make generic components. For example, imagine a generic `Navbar` +component, which displays a navbar, but with some customizable content. Since +the specific content is only known to the user of the `Navbar`, it would be nice +to specify it in the template where `Navbar` is used: ```xml -