AddThisFeature

Responsive Prop System

Let any component take a per-breakpoint value through one predictable, consistent API.

involved Components & Primitives

What it adds

A single convention for passing breakpoint-aware values to components, with defined merge order and bounded output.

What your agent is told to do

5
  1. 1

    Find where the codebase currently handles responsiveness by hand — duplicated components for mobile and desktop, conditional rendering on a width check, one-off utility classes — and replace those with a single responsive value convention.

  2. 2

    Define the merge order once and document it: a value given for a breakpoint applies from that breakpoint up until another overrides it, and a bare value is the base that applies everywhere. Ambiguity here produces layouts nobody can predict from reading the call site.

  3. 3

    Restrict the convention to the props where it earns its keep — layout, spacing, sizing, column counts, visibility — and reject it elsewhere with a clear error rather than silently ignoring it.

  4. 4

    Resolve responsive values through the app's existing breakpoint definitions rather than inventing a parallel set of widths. Two competing breakpoint scales in one codebase is worse than none.

  5. 5

    Do not implement the resolution by reading window width in script and re-rendering. That produces a wrong first paint on the server, a visible snap on hydration, and a re-render on every resize; the resolution belongs in the styling layer where the browser can do it.

Edge cases it handles

7
  • The merge order across breakpoints must be stated and enforced. If a value set at a middle breakpoint does or does not carry upward to the largest, and the answer is not written down and applied uniformly, every call site becomes trial and error.
  • A responsive value passed to a prop that does not support it must fail loudly at development time rather than being coerced or dropped. Silently rendering the object as a string, or picking its first entry, hides the mistake until it reaches a user.
  • Server-rendered output must be deterministic, so nothing may depend on the actual viewport at render time. If the server guesses a breakpoint, the first paint is wrong for half the audience and flickers into place on hydration.
  • Generating one style rule per prop per breakpoint per instance grows the stylesheet without bound. Constrain the accepted values to the design scale and reuse generated rules so a page with two hundred components does not ship two hundred near-identical declarations.
  • Responsive values must compose with the app's existing style overrides in a defined order, so a breakpoint value does not unexpectedly beat an explicit override at the call site, or lose to one.
  • This brief owns only how a value varies across breakpoints. The named set of allowed values for a prop — sizes, tones, emphasis levels — belongs to Component Variant API, and the two must share one vocabulary rather than each defining its own.
  • Values that cannot vary meaningfully by breakpoint, such as a semantic element type or an accessible label, must be excluded from the convention outright.

Definition of done

9
  • Every component that accepts responsive values uses the same prop shape and the same merge order.
  • The merge order is documented and holds for every supported prop.
  • A responsive value on an unsupported prop raises a clear development-time error.
  • Server-rendered markup is identical regardless of the requesting device, and hydration produces no visible snap.
  • Breakpoints come from the app's existing definitions, with no second set of widths.
  • Generated style output grows with the number of distinct values used, not with the number of component instances.
  • Duplicate mobile and desktop variants of the same component have 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.