Skip to main content

Overview

React Grab’s theming system allows you to customize the visual appearance of the overlay, selection boxes, labels, and other UI elements. The theme uses an HSL color space with a configurable base hue for consistent color generation.

Theme Interface

The Theme interface defines all customizable visual elements:
boolean
default:"true"
Globally toggle the entire overlay. When false, React Grab functionality is disabled but the API remains available.
number
default:"0"
Base hue (0-360) used to generate colors throughout the interface using HSL color space.Examples:
  • 0 - Red
  • 120 - Green
  • 240 - Blue
  • 280 - Purple

Selection Box

object
The highlight box that appears when hovering over an element before selecting it.

Drag Box

object
The rectangular selection area that appears when clicking and dragging to select multiple elements.

Grabbed Boxes

object
Brief flash/highlight boxes that appear on elements immediately after they’re successfully grabbed/copied.

Element Label

object
The floating label that follows the cursor showing information about the currently hovered element.

Crosshair

object
The crosshair cursor overlay that helps with precise element targeting.

Toolbar

object
The floating toolbar that allows toggling React Grab activation.

Applying Themes

Via Plugin

The recommended way to apply themes is through a plugin:

Via Init Options

You can also pass theme options when initializing React Grab:

Dynamic Theme Updates

Themes can be updated dynamically through plugins:

DeepPartial Type

React Grab uses a DeepPartial type for theme overrides, allowing you to specify only the properties you want to change:
This means you can provide partial theme objects without specifying every property:

Theme Examples

Minimal Theme

Disable all visual indicators except the selection box:

High Contrast Theme

Use a bright color for better visibility:

Brand Color Theme

Match your brand colors:

Stealth Mode

Minimize visual distraction:

Color System

The hue value determines the base color using the HSL color model: The saturation and lightness are automatically calculated to ensure good contrast and readability.

Multiple Theme Plugins

You can register multiple plugins with theme overrides. Themes are merged in the order plugins are registered:

Best Practices

  1. Use Named Plugins: Give theme plugins descriptive names for easier debugging
  2. Partial Updates: Only override the properties you need to change
  3. Consistent Hues: Stick to a single hue value for visual consistency
  4. Test Visibility: Ensure your theme provides sufficient contrast on your application’s background
  5. Consider Accessibility: High contrast themes help users with visual impairments

See Also