Interface: Layout

Rule

Principles

  • MUSTDeliberate alignment (grid/baseline/edges/optical centers)
  • MUSTVerify mobile, laptop, ultra-wide (simulate at 50% zoom)
  • MUSTRespect safe areas via env(safe-area-inset-*)
  • MUSTNo unwanted scrollbars — fix overflows
  • SHOULDOptical alignment: ±1px when perception beats geometry
  • SHOULDBalance icon/text lockups (stroke, weight, size, spacing, color)

Viewport

  • MUSTh-dvh not h-screen (respects mobile browser chrome)
  • MUSTFixed elements respect safe-area-inset-*

Z-Index

MUST use fixed scale — no arbitrary values like z-[999]:

LayerTailwindCSS Variable
Basez-0
Dropdownz-10--z-dropdown: 100
Stickyz-20
Modalz-30--z-modal: 200
Toastz-40--z-toast: 400
Tooltipz-50--z-tooltip: 300

Avoiding Z-Index

  • SHOULDUse isolate (Tailwind) to create stacking context without z-index:
<div className="isolate">
  {/* New stacking context, no global z-index conflict */}
</div>