{slot}

A named place in a custom tag's template - and the fill a caller gives it.

Layouts and components Either form

Syntax

{slot 'name'} default content {/slot}
{slot 'name'} <footer>@content@</footer> {/slot}
{slot 'name'/}

Parameters

name
The slot's name, required.

Description

{slot} gives a custom tag - a template in _tags/ or _common, or an _include snippet used as a pair - more than one place for the caller's content. Like {block} it plays two roles depending on where it stands.

  • A {slot 'name'} pair standing directly in the content of a custom tag where it is used is a fill. It is taken out of the content when the tag opens and kept for that one use of the tag; the rest of the content goes to the template's @content@. {slot 'name'/} there is an empty fill.
  • Every other {slot} - in the tag's template - is a place: the fill renders there, or, when the caller gave none, the slot's own content as a default.

A default that holds @content@ is a frame around the fill: {slot 'footer'}<footer>@content@</footer>{/slot} renders the footer element only when there is a fill to put in it; otherwise its @else@ part, or nothing. A fill is the caller's text: it renders with the caller's variables, and a {#name} or {slot} inside it belongs to the caller's own tag, which is how a template passes a slot of its own on to a tag it uses. From a tag's PHP, padSlotFill ( 'footer' ) reads a fill.

Under the strict check a slot without a name, and a slot outside any custom tag, are errors. The examples use the application's tag _tags/slotCard.pad, a card with a title slot (default Untitled) and a framed footer slot.

Examples

Filling the slots

A custom tag with a title slot and a footer slot; the caller fills both, the rest of its content goes to @content@.

Templateexamples/slot/1-fill.pad
{slotCard}
  {slot 'title'}Revenue{/slot}
  <p>€ 12,400 this month.</p>
  {slot 'footer'}Updated on 1 October 2026{/slot}
{/slotCard}
Resultopen alone

Revenue

€ 12,400 this month.

Updated on 1 October 2026

Defaults and an empty frame

Without fills the title slot shows its default, and the footer frame - which holds @content@ - shows nothing.

Templateexamples/slot/2-default.pad
{slotCard}
  <p>A card without a title or footer of its own.</p>
{/slotCard}
Resultopen alone

Untitled

A card without a title or footer of its own.

See also

  • {parms} Declares the parameters of a custom tag, with defaults, at the top of its template.
  • {define} Writes a custom tag in the template itself - what a _tags/name.pad file is, without the file.
  • {macro} A template function: declared parameters, given in order or by name, read as fields inside its body.
  • {block} A named region of a layout or wrapper - and a page's override of it.
  • {shadow} The shadow root of a custom element, rendered on the server as declarative shadow DOM.