# Props vs CSS Rules and patterns for handling visual/layout properties that vary by breakpoint. --- ## Should This Be a React Prop or CSS? ``` Is this a content/data property? │ ├─ YES → Can it be derived from other props / internal state? │ │ │ ├─ YES (subtotal = price × qty, fullName = first + last, etc.) │ │ └─ ❌ NOT a prop → compute internally │ │ │ └─ NO (label, items, imageSrc, link, title, etc.) │ └─ ✅ React prop │ └─ NO → Would a user want this to vary per breakpoint? │ ├─ YES (showLabel, orientation, displayMode, iconPosition) │ └─ ❌ NOT a prop → CSS only │ └─ NO → Is it direction (RTL/LTR)? │ ├─ YES │ └─ ✅ React prop (internationalization) │ └─ NO → Is it behavior (disabled, required)? │ ├─ YES │ └─ ✅ React prop │ └─ NO └─ ❌ NOT a prop → CSS only ``` --- ## Rules Components must distinguish between content/data and visual/layout properties: - **Content/Data** (same across all breakpoints) → React props ✅ - **Visual/Layout** (vary by breakpoint) → CSS only, NOT props ❌ ### What CAN be props - Content data that stays the same: `label`, `items`, `imageSrc`, `link`, `title` - Behavior that's consistent: `disabled`, `required`, `searchable`, `multiple` ### What CANNOT be props (must be CSS) - Visual display decisions: `showLabel`, `showIcon`, `displayMode`, `iconOnly` - Layout decisions: `orientation`, `alignment`, `compact` - Visibility toggles: `hideOnMobile`, `showOnDesktop`, `mobileView` ### Critical: ALL Show/Hide Toggles Are Visual/Layout Properties Props like `showProgressBar`, `showVolumeControls`, `showTimeDisplay`, `showNavigation`, `showControls` are visual display decisions that CANNOT be props. **Why:** Show/hide decisions affect layout and users need breakpoint control: - Show progress bar on desktop, hide on mobile - Show cover art on desktop, hide on tablet - Show full controls on large screens, minimal on small screens **Pattern:** These look like "feature toggles" but they're actually "layout modes". **Exception:** `direction` (RTL/LTR) is a mandatory prop for internationalization, not a breakpoint-responsive property. **Critical Rule:** If a property should be customizable per breakpoint, it CANNOT be a React prop. ### How to Implement Visibility/display properties can be overridden per breakpoint by the user via the editor — but, just like background colors, the component still authors the resting defaults in CSS: 1. **Always render all elements** — No conditional rendering with props 2. **Do NOT hardcode visibility-toggling display in CSS** (e.g. `display: none` to hide an element by default) — visibility is user-controlled per breakpoint. Layout `display` (`flex`, `grid`, etc.) on layout containers is fine and expected. Resting visual properties (background, color, border-radius, padding, font) DO belong in CSS — see `CSS-GUIDELINES.md`. 3. **Visibility is user-controlled** — Users control what shows/hides per breakpoint via the editor ```tsx // ✅ CORRECT: Always render