You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/guide/components.md
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -633,8 +633,10 @@ When there is only one `<content>` tag with no attributes, the entire original c
633
633
Template for `my-component`:
634
634
635
635
```html
636
-
<h1>This is my component!</h1>
637
-
<content>This will only be displayed if no content is inserted</content>
636
+
<div>
637
+
<h1>This is my component!</h1>
638
+
<content>This will only be displayed if no content is inserted</content>
639
+
</div>
638
640
```
639
641
640
642
Parent markup that uses the component:
@@ -649,11 +651,11 @@ Parent markup that uses the component:
649
651
The rendered result will be:
650
652
651
653
```html
652
-
<my-component>
654
+
<div>
653
655
<h1>This is my component!</h1>
654
656
<p>This is some original content</p>
655
657
<p>This is some more original content</p>
656
-
</my-component>
658
+
</div>
657
659
```
658
660
659
661
### Multiple Insertion Points
@@ -665,9 +667,11 @@ The rendered result will be:
665
667
For example, suppose we have a `multi-insertion` component with the following template:
666
668
667
669
```html
668
-
<contentselect="p:nth-child(3)"></content>
669
-
<contentselect="p:nth-child(2)"></content>
670
-
<contentselect="p:nth-child(1)"></content>
670
+
<div>
671
+
<contentselect="p:nth-child(3)"></content>
672
+
<contentselect="p:nth-child(2)"></content>
673
+
<contentselect="p:nth-child(1)"></content>
674
+
</div>
671
675
```
672
676
673
677
Parent markup:
@@ -683,11 +687,11 @@ Parent markup:
683
687
The rendered result will be:
684
688
685
689
```html
686
-
<multi-insertion>
690
+
<div>
687
691
<p>Three</p>
688
692
<p>Two</p>
689
693
<p>One</p>
690
-
</multi-insertion>
694
+
</div>
691
695
```
692
696
693
697
The content insertion mechanism provides fine control over how original content should be manipulated or displayed, making components extremely flexible and composable.
0 commit comments