This page assumes you've already read the Components Basics. Read that first if you are
new to components.
Slot Content and Outlet
We have learned that components can accept
props, which can be JavaScript values of any type. But how about template content? In
some cases, we may want to pass a template fragment to a child component, and let the
child component render the fragment within its own template.
For example, we may have a
component that supports usage like this:
template < FancyButton > Click
me! FancyButton >
The template of looks like
this:
template < button class = "fancy-btn" > < slot > slot >
button >
The element is a slot outlet that indicates where the parent-provided
slot content should be rendered.
And the final rendered DOM:
html < button class =
"fancy-btn" >Click me! button >
With slots, the is responsible for
rendering the outer