AddThisFeature

Dialog Size Rules

Fix a small set of dialog widths so every modal in the app looks deliberate.

moderate Components & Primitives

What it adds

A defined set of dialog sizes with agreed maximum widths, scroll behaviour, and responsive treatment.

What your agent is told to do

5
  1. 1

    Inventory every dialog in the app and record its current width. The list will contain a spread of arbitrary values, and collapsing them onto four named sizes is most of the work.

  2. 2

    Define the sizes by intent, not by pixel value in the calling code: a confirmation size, a standard form size, a wide size for tables and comparisons, and a full-screen size for genuinely large tasks.

  3. 3

    Give every size the same internal structure — a header that stays, a body that scrolls, a footer that stays — so the action buttons never scroll out of reach in a long dialog.

  4. 4

    Cap the dialog's height against the real viewport height rather than a fixed value, and put the overflow on the body region.

  5. 5

    Do not let callers pass arbitrary widths as an escape hatch. The moment one screen can specify its own, the scale stops being a scale and the inventory you just consolidated grows back.

Edge cases it handles

7
  • The scroll must live in the body region only. If the whole dialog scrolls, the header and footer leave the screen; if the page behind scrolls instead, the user loses their place entirely.
  • A confirmation with one sentence and two buttons stretched to a wide dialog reads as a mistake and makes the destructive button look far from the text it refers to. Match size to content, and keep confirmations small.
  • Sticky headers and footers must survive at every size and at every content length, including when the body is short enough not to scroll, without leaving a gap or a doubled border.
  • Below the mobile breakpoint, small and standard dialogs should become full-width sheets and the wide size should become full-screen, rather than a shrunken desktop dialog with cramped margins.
  • A dialog containing a table wider than the dialog needs that table to scroll horizontally inside its own region, not to force the dialog wider or spill past its edge.
  • The on-screen keyboard on mobile reduces the usable height sharply, and a dialog sized against the full screen height will push its footer under the keyboard.
  • Long unbroken content — a pasted identifier, a URL, a stack trace — must wrap or scroll rather than widening the dialog past its declared size.

Definition of done

9
  • Every dialog in the app uses one of the named sizes, with no arbitrary widths remaining.
  • Each size has a documented intent and a maximum width.
  • Scrolling happens in the dialog body while the header and footer stay in place.
  • Dialog height is capped against the real viewport, including when the on-screen keyboard is open.
  • Confirmations use the small size and are never stretched.
  • Small and standard dialogs become full-width sheets on mobile, and wide dialogs become full-screen.
  • No dialog exceeds its declared size because of its content.
  • 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.