React and nextjs data visualization

From openai/plugins · View interactive version

React and nextjs data visualization is an AI agent skill from the GitHub repository openai/plugins. Integrate data visualizations into React and Next.js applications. Use when the user needs chart components, UML-like or architecture diagram components, React integration patterns, Next.js client or server boundaries, hydration-safe rendering, lazy loading, framework-aware performance, scroll-drive

How to use this skill

Skill file

React and Next.js Data Visualization

Overview

Use this skill when the visualization lives inside a React or Next.js product surface. The focus is not just chart rendering. The focus is component ownership, hydration safety, client and server boundaries, bundle strategy, and clean integration between React and whichever visualization layer is actually drawing the marks.

Default assumption: React should own structure, layout, and application state, while the visualization layer owns scales, geometry, and narrowly scoped imperative rendering.

If the main request is about screenshot testing, visual regression, mocked chart data, or E2E coverage strategy, route first to ../testing-data-visualizations/SKILL.md and pair back to this skill only for React- or Next-specific implementation details.

Choose This Skill When

Working Pattern

  1. Decide which parts are server-safe and which must run in the browser.
  2. Keep data loading, transformation, chart configuration, and render-layer concerns separated.
  3. Estimate how many chart instances can be visible on a page at once and whether expensive work can be shared across them.
  4. Let React own layout, controls, routing state, persistence affordances, and active-state summaries.
  5. Let D3, Canvas, Vega-Lite embeds, Plot, WebGL libraries, or Three.js own the mark-level rendering.
  6. Model URL-backed view state explicitly before wiring controls: filters, range, metric, comparison, selected entity, active tab, map bounds, zoom, camera target, and drill-down path.
  7. Use localStorage only for tiny personal preferences; use IndexedDB or remote storage for larger saved views, drafts, cached slices, custom annotations, or shared/cross-device workspaces. Incoming URL state should override persisted defaults.
  8. Use dynamic loading or client-only boundaries intentionally for browser-only visualization code.
  9. If the chart owns wheel, pinch, or drag interactions, make the browser contract explicit. Use a non-passive native listener or library hook when default scrolling must be canceled, and do not assume framework-level onWheel is enough.
  10. For editorial or infographic surfaces, keep the insight title, artifact mode, subtitle, annotation plan, source note, large-screen layout, mobile portrait layout, optional mobile landscape layout, and chart render layer as explicit component responsibilities. Use ../../references/foundations/mobile-first-responsive-visualization.md for touch, keyboard, visual viewport, spotty-connection, and device-capability decisions.
  11. For scrollytelling or parallax, use ../scrollytelling-and-parallax-data-visualization/SKILL.md for the story contract. Model scenes as typed state rather than ad hoc scroll math. Each scene should define visible layers, annotation text, media assets, camera or transform state, trigger/progress range, static key frame, and reduced-motion fallback.
  12. For advanced editorial, report, deck, generated-image, animation, or existing-page integration work, use ../../references/foundations/meaning-preserving-visual-design-workflow.md and ../../references/foundations/mobile-first-responsive-visualization.md before implementation. Apply the shared workflow for concept images, large-screen/mobile variants, approval or iteration, and the binding semantic design contract React must implement.
  13. For generated imagery or illustration, keep assets in deterministic public paths or importable modules, and keep labels/data overlays in React-owned, editable layers.
  14. For WebGL, keep renderer lifecycle, resize, context loss, disposal, and animation loops inside a narrow client-only component boundary. React should pass data versions and props, not mutate GPU objects throughout the tree.
  15. For interactive UML, ERD, dependency, state machine, flow, or architecture diagrams, use ../uml-and-software-architecture-visualization/SKILL.md first; React should own app state, panels, controls, routing, and persistence while the diagram layer owns layout/rendering details.
  16. For operational workspaces, use ../../references/foundations/operational-visualization-workspaces.md before component decomposition. React should own shell state, command bars, drawers, rails, active summaries, URL state, and inspector synchronization while the visualization layer owns geometry, layout, and picking.

Next.js Guidance

Output Expectations

References

Representative Prompts

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.