The <captioned-thumbnail>
element can be used within other components, but it is expected that the element will be composed - including its slots - by the implementing component.
Any slots passed down through <slot>
elements can only be manipulated by forwarding the expected slots in the shadow dom of the parent component.
To demonstrate this, note that the first entry does not pass any slots, and appears regularly. The second passes slots for the label and edit button. The third example passes in the icon slot. Each of these examples only work because they are being handled by the <shadow-wrapper-container>
and <shadow-wrapper>
elements, during the slotchange
events.
Note that the actual slotted elements, themselves, need to be added to a default <slot>
element in the wrapper container. This is due to the slot
attribute being set, on each element, effectively making them invisible to the default slot in the wrapper container. To work around this, all subslot elements are added to a <slot>
element, which is then handled by the wrapper element to assign the slots appropriately for the <captioned-thumbnail>
element.
event
s, unlike slot
s, work just fine with nesting. This is demonstrated by each component still triggering events simply by listening to the example element, showing that even deeply nested events still bubble through to the light DOM.