Layouts & Slots
A slot is the spot in a component (or layout) where the content you put
between its tags shows up. A Card component might have a slot for its body
text, and a page layout has a slot where each page’s own content goes. In
Astro it’s written <slot />; a named slot (<slot name="footer" />)
lets a component have more than one.
See where the slots are
Section titled “See where the slots are”Empty slots show on the canvas as dashed boxes labelled slot (the default slot) or slot: name (a named slot). To keep the page readable, they appear only:
- while you’re dragging something in from the Add panel, and
- around the slots inside the element you’ve selected.
Put content into a slot
Section titled “Put content into a slot”Drag an element, component, or Library section from Add onto a slot box.
Plyed writes it between that component’s tags on your page, not into the
component’s own file, so other uses of the component don’t change. For a
named slot it adds slot="name" for you, so the content lands in the right
place.
Selecting a component and adding Inside it (from Add or Quick Insert) fills its default slot the same way. If the component has no slot, the new element goes after it instead, and the status bar says so.
Add a slot to a component or layout
Section titled “Add a slot to a component or layout”Slot and Named slot are in the Add panel and in
Quick Insert. A slot only makes
sense inside a component or layout, so Plyed won’t put one in a page; edit
the component itself (with every instance selected, or in its file under
Source). After adding a Named slot, rename it from name to
something that describes it.
Slots and deleting
Section titled “Slots and deleting”Deleting the element that holds a component’s or layout’s <slot /> would
hide the content of everything that uses it, so Plyed refuses. Use
Unwrap to remove the wrapper and keep the slot, or edit the file in
Source.
In Elements you can drag something that lives in a layout (its nav, for
example) above or below the page content that layout shows through its slot.
Plyed moves it before or after the layout’s <slot />, which changes it on
every page that uses the layout.
See One page, or every page? for how layouts decide whether an insert reaches one page or all of them.