--- title: Slots description: A guide to using slots in Coldspa components. --- `cf_Island` captures any HTML between its opening and closing tags and passes it to your component as the **default** slot. Use the `` child tag to project additional **named** slots. Both forms accept dynamic CFML markup (queries, conditionals, includes) and stream it straight into a Vue/React component. ## Default slot ### CFML side ```cfml SELECT title, body, createdAt FROM posts WHERE userID =

#title#

#body#

``` ### Vue component ```vue ``` ### React component ```jsx export default function PostList({ children }) { return
{children}
; } ``` ## Named slots Wrap any sub-section of the body in `` to expose it as a named slot. The wrapped HTML is **removed** from the default slot and routed to the framework as a named slot (Vue) or a same-named prop (React). ### CFML side ```cfml

This goes into the default slot.

#post.title#

#author#: #body#
``` ### Vue component Named slots are exposed via ``, exactly as Vue normally handles them: ```vue ``` ### React component React doesn't have a slot concept, so each named slot is delivered as a **prop of the same name**, pre-wrapped in a `` with the slot's HTML. The default slot is still `children`. ```jsx export default function Card({ header, footer, children }) { return (
{header}
{children}
{footer}
); } ``` ### Rules for `cf_Slot` - **Must be nested directly inside a `cf_Island`.** Throws `Coldspa.OrphanSlot` otherwise. - **`name` is required** and must be a valid identifier matching `^[A-Za-z_][A-Za-z0-9_]*$`. Throws `Coldspa.InvalidSlotName` otherwise. - **`name="default"` is reserved.** Place default-slot content directly inside `cf_Island`. - **Last write wins.** Two `` tags in the same island? The second overwrites the first. - The slot's own markup is stripped from the parent's `generatedContent`, so it never leaks into the default slot. ## How it works 1. `cf_Island` runs on **both passes**: - **Start pass**: initializes `namedSlots = {}` on the tag scope so child `` tags have somewhere to attach. - **End pass**: reads the rendered body from `thisTag.generatedContent` (default slot) plus the populated `namedSlots` struct. 2. Each `` runs on its end pass, walks up to the parent via `getBaseTagData("CF_ISLAND")`, and writes `parent.namedSlots[name] = body`. 3. Each slot's HTML (default + named) is stashed in a sibling `