Configuration

Element Exclusion

You can exclude specific elements and their descendants from ruio's border visualization by applying the ruio-exclude class.

Basic Usage

<div className="ruio-exclude">{/* This content and all descendants will be excluded from ruio */}</div>

How It Works

  • Inclusive Exclusion: When you add ruio-exclude to an element, both that element AND all its descendants are excluded

  • Automatic: The ruio UI controls automatically have this class applied

  • No Configuration Needed: Just add the class name - ruio handles the rest

Common Use Cases

Excluding Modals

function Modal({ children }) {
  return (
    <div className="ruio-exclude modal-overlay">
      <div className="modal-content">
        {children}
      </div>
    </div>
  )
}

Excluding Navigation

Excluding Third-Party Widgets

Excluding Fixed Overlays

Multiple Classes

You can combine ruio-exclude with your existing classes:

Or use it with CSS modules:

Environment Configuration

Development vs Production

ruio automatically detects the environment using process.env.NODE_ENV:

Enabling in Production (Demo Apps)

For production demo apps or staging environments, you can override the default behavior:

Use Cases:

  • Demo applications where you want to showcase ruio

  • Staging environments for debugging

  • Production apps where you need to visualize component hierarchy

Note: Only use showInProduction when you intentionally want ruio visible to end users.

Custom Environment Detection

If you need custom environment detection, you can conditionally render the provider:

Or use the showInProduction prop for simpler cases:

Root Element Configuration

Auto-Detection

ruio automatically detects your application's root element. It tries the following selectors in order:

  1. User's saved selection (from localStorage)

  2. Custom defaultRootSelector prop (if provided)

  3. #root (most common)

  4. #app (alternative common pattern)

  5. [data-reactroot] (older React versions)

  6. body > div:first-child (universal fallback)

Custom Root Selector

For non-standard app structures, pass the defaultRootSelector prop:

Common Use Cases:

Manual Selection

You can also manually select a root element at runtime:

  1. Enable ruio

  2. Click the crosshair icon (element selection mode)

  3. Click any element to make it the new root

  4. The selection persists across page refreshes

LocalStorage Settings

ruio automatically persists settings to localStorage. You can manually inspect or modify these:

Storage Keys

Key
Value Type
Description

ruio_enabled

boolean

Whether ruio is enabled

ruio_root_selector

string

CSS selector for the root element

Inspecting Storage

Clearing Settings

Planned Configuration Features

The following features are planned for future releases:

UI Depth Selection

Control how deep ruio crawls the DOM tree:

Options will include:

  • Crawl deeper down the DOM tree

  • Option to crawl up the DOM tree

  • Simultaneously crawl the DOM upwards and downwards

Color Theming

Customize the color palette used for border visualization:

Keyboard Shortcuts

Keyboard macros for quick access:

Custom Positioning

Control where the ruio UI appears:

TypeScript Configuration

ruio includes full TypeScript support out of the box. No additional configuration needed!

Type Definitions

All types are automatically available when you import from ruio:

Custom Types

If you're building custom controls, you can import the context type:

Best Practices

  1. Always exclude overlays: Modal overlays, tooltips, and fixed elements should use ruio-exclude

  2. Keep it in development only: Let ruio's automatic environment detection handle production

  3. Don't over-exclude: Only exclude elements that interfere with visualization

  4. Use semantic class names: Combine ruio-exclude with descriptive class names for clarity

Need More Configuration?

If you need configuration options not listed here, please:

  1. Check the GitHub issues to see if it's been requested

  2. Open a new issue describing your use case

  3. Contribute! See the Contributing Guide

Last updated

Was this helpful?