AddThisFeature

Slot-Based Composition

Let components take content in named positions instead of accumulating a prop per element.

moderate Components & Primitives

What it adds

Named content positions on layout-shaped components, with defaults, validation, and an accessible source order.

What your agent is told to do

5
  1. 1

    Find the components that have grown a prop for every possible piece of content — icon, title, subtitle, badge, action, footer — and replace that accumulation with a small set of named positions.

  2. 2

    Name each position for its role in the layout rather than for what is typically put in it, so a position remains truthful when a caller puts something unexpected there.

  3. 3

    Give each position a sensible default or a defined empty behaviour, so an omitted position collapses cleanly instead of leaving a gap, a stray separator, or a border around nothing.

  4. 4

    Keep the source order of the rendered output meaningful even where visual order differs, so keyboard and screen reader users encounter the content in a sequence that makes sense.

  5. 5

    Do not implement positions by matching on child type, position in the child list, or a class name applied by the caller. Those break as soon as content is wrapped or conditionally rendered, and they give a caller no way to find out what went wrong.

Edge cases it handles

7
  • Required and mutually exclusive positions must be validated. A component with no content in its required position, or with two positions filled that were never meant to appear together, should say so at development time rather than rendering something misaligned.
  • Visual order and source order can diverge once positions are laid out with a grid or reordered for a breakpoint, and when they do the keyboard tab sequence stops matching what is on screen. Keep the accessible order deliberate rather than letting the layout decide it.
  • Every position needs a defined behaviour when it is empty. Reserving space for an absent icon, or drawing a separator above a footer nobody supplied, is the usual result of leaving it unspecified.
  • Selecting content by child type or list position is brittle: wrapping one item in a conditional, a fragment, or a caller's own component silently drops it into the wrong place or out of the render entirely. Positions must be addressed by name.
  • Content placed in a position must not be able to break the component's own layout — an over-long title, a tall image, a translated label at three times the English length — so each position needs its own constraints for wrapping, truncation, and maximum size.
  • Nesting a component inside one of its own positions must resolve unambiguously, so an inner card's footer is not styled by the outer card's rules.
  • The set of positions is part of the component's contract, so removing or renaming one is a breaking change and needs treating as such.

Definition of done

9
  • Layout-shaped components accept content by named position rather than through a prop per element.
  • Positions are addressed by name, with no matching on child type, index, or class name.
  • Missing required positions and mutually exclusive combinations raise development-time errors.
  • An omitted position collapses cleanly, with no reserved space, stray separator, or empty border.
  • Source order remains meaningful for keyboard and screen reader users at every breakpoint.
  • Over-long or over-tall content in a position is constrained rather than breaking the component's layout.
  • The prop-per-element accumulation on the affected components has been removed.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.