TheGoat395/Codex-Skills / skills/react-responsive-components
react-responsive-components
VerifiedImplement size-dependent behavior/geometry.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 984 B |
| agents/openai.yaml | config | 296 B |
| references/react-responsive-components-guide.md | markdown | 3.3 KB |
references/react-responsive-components-guide.md
View on GitHub# React Responsive Components Guide
## Purpose
Make mobile layouts intentionally composed rather than merely stacked.
## Use When
- A React component or page must work across mobile, tablet, and desktop.
- A premium site has text overflow, cramped buttons, broken media crops, card stacking, or horizontal scroll.
- The component has fixed-format UI such as boards, toolbars, grids, galleries, counters, or tiles.
## Do Not Use When
- The change is not visible or has no layout impact.
- A one-off desktop-only internal tool is explicitly requested.
- The project is not React and a CSS-specific skill applies better.
## Discovery Questions
- Which breakpoints or container widths does the existing system use?
- What must remain visible or actionable on mobile?
- Which elements need stable dimensions to prevent layout shift?
- Can CSS solve this without JavaScript measurement?
## Decision Tree
- Start CSS-first with grid, flex, clamp limits, aspect ratio, min/max, and container-aware patterns.
- Use JavaScript measurement only when layout depends on real runtime geometry.
- Design mobile composition separately; do not rely on automatic stacking for premium pages.
- Lock stable dimensions for controls, boards, tiles, and media frames.
- After editing, inspect at least one mobile and one desktop viewport.
## Implementation Rules
- Avoid unbounded `vw`-only typography. Bounded fluid type such as `clamp()` with readable minimum/maximum and font-relative sizing is valid; test zoom, reflow and long content.
- Prevent horizontal overflow and long-word breakage.
- Use aspect-ratio and object-fit for media crops.
- Keep tap targets comfortable and icons/text from colliding.
- Avoid nested cards and cramped card stacks on mobile.
## Useful Patterns
- Editorial section: desktop asymmetric grid, mobile reordered media and copy with designed rhythm.
- Product UI: desktop dense mockup, mobile cropped/stacked views with zoomed details.
- Dashboard: responsive table strategy, filters collapse, core metric remains visible.
## Anti-Patterns
- Desktop layout with `scale(.7)` on mobile.
- Hero text that overlaps media at mid-widths.
- Icon buttons that resize because labels or hover states change.
- Cards nested in cards to solve spacing.
## QA Checklist
- Check common widths around 390, 768, 1024, and 1440 when possible.
- Inspect horizontal scroll and text overflow.
- Test hover-only affordances on touch.
- Verify media crops show the actual subject.
## Acceptance Criteria
- The component feels designed at mobile and desktop sizes.
- No visible overlap, overflow, or accidental resizing occurs.
- Responsive behavior supports the site's visual direction.
## Shared scope
For applicable substantial web work, reuse the [shared scoped web contract](../../website-operating-rules/references/scoped-web-contract.md) when available. Preserve current authorization, stack and requested scope; this optional reference does not require another planning or approval cycle.
## Official Source Anchors
- React Learn: https://react.dev/learn
- Image optimization: https://nextjs.org/docs/app/getting-started/images
Preserve semantic DOM reading and keyboard order across responsive arrangements; visual reordering must not create a conflicting interaction sequence. Test the supported viewport scope rather than imposing a mobile rebuild on an explicitly desktop-only brief.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |