Overview
The toolbar is implemented using Preact and renders within a Shadow DOM to avoid CSS conflicts with your application. It’s initialized automatically when you callscan() with showToolbar: true (the default).
The toolbar uses Shadow DOM isolation, so your application’s styles won’t interfere with its appearance.
Enabling/Disabling the Toolbar
Control toolbar visibility through theshowToolbar option:
FPS Meter
The toolbar includes a real-time FPS (frames per second) meter that helps you monitor rendering performance.How it Works
The FPS meter tracks frame rendering performance usingrequestAnimationFrame:
Configuration
Control FPS meter visibility:The FPS counter helps identify performance bottlenecks. A consistent 60 FPS indicates smooth rendering, while drops suggest optimization opportunities.
Notification Count
The toolbar displays a count of performance slowdown notifications detected during interactions.Slowdown Detection
React Scan tracks user interactions (clicks, keypresses) and measures their latency:- Pointer interactions (clicks, pointer events)
- Keyboard interactions (keypresses, input changes)
- Performance entries from the browser’s Event Timing API
Configuration
Notification Storage
Notifications are stored in a bounded array with a maximum of 25 interactions:Toolbar Positioning
The toolbar is draggable and remembers its position using localStorage.Default Behavior
- Appears in the bottom-right corner by default
- Can be dragged to any corner
- Position persists across page reloads
- Maintains safe area of 24px from viewport edges
Collapsible State
The toolbar can collapse to save screen space:react-scan-widget-collapsed-v1.
Minimum Dimensions
The toolbar enforces minimum size constraints:Error Handling
The toolbar includes an error boundary to gracefully handle crashes:Local Storage Keys
The toolbar stores configuration in localStorage:react-scan-widget-settings-v2: Widget position and dimensionsreact-scan-widget-collapsed-v1: Collapsed statereact-scan-widget-last-view-v1: Last active viewreact-scan-options: Scanning options (enabled state, etc.)
Clearing localStorage will reset toolbar position and settings to defaults.
Implementation Details
Shadow Root Isolation
The toolbar creates a shadow root for style isolation:Lifecycle Management
The toolbar properly cleans up when removed:Best Practices
- Keep toolbar visible during development to monitor performance in real-time
- Check FPS meter during interactions to identify rendering bottlenecks
- Monitor notification count to track performance regressions
- Collapse toolbar when needed to maximize screen space without losing functionality
- Disable in production by setting
enabled: falseor conditionally based onprocess.env.NODE_ENV
Related Options
- Render Detection - Configure what renders to highlight
- Performance Monitoring - Track and analyze performance
- Browser Extension - Use React Scan as a browser extension