React Data Inspector
Documentation / Reference

Styling reference

CSS variables, stable data attributes, and layout requirements.

Scoped styles and specificity

Import @nipe-solutions/react-data-inspector/styles.css once. Default appearance uses zero-specificity selectors rooted in [data-rdi-root]:not([data-rdi-unstyled]). There is no global reset or CSS-in-JS runtime.

A consumer class can override the variables directly. DOM nesting and implementation class names are not a public contract.

CSS variables

VariablePurposeLight compact default
--rdi-font-familyFont stackui-monospace, SFMono-Regular, Consolas, monospace
--rdi-font-sizeText size13px
--rdi-line-heightText line height1.5
--rdi-backgroundSurface#fff
--rdi-foregroundMain text#262b33
--rdi-mutedSecondary text#656c78
--rdi-key-colorProperty labels#344359
--rdi-string-colorString values#286547
--rdi-number-colorNumber and bigint values#92500b
--rdi-boolean-colorBoolean values#794b91
--rdi-null-colorNullish and accessor values#76707c
--rdi-special-colorSpecial type values#315e8f
--rdi-row-heightUniform row height28px
--rdi-indentLogical indentation step18px
--rdi-radiusFrame corner radius6px
--rdi-border-colorFrame and control border#dfe2e7
--rdi-hover-backgroundHovered row#f2f4f6
--rdi-selected-backgroundSelected row#e8edf5
--rdi-focus-ringVisible focus#365f94

Dark/system themes override color defaults. Comfortable density uses 36px rows; coarse pointers use 40px rows in the default styles. Consumer overrides still need to leave content readable and controls usable.

Stable presence attributes

AttributeMeaning
data-rdi-rootInspector root
data-rdi-treeTree navigation and scroll region
data-rdi-nodeMeaningful navigation row
data-rdi-keyKey content
data-rdi-valueValue content
data-rdi-toggleExpansion control
data-rdi-actionsNode actions region
data-rdi-referenceReference content
data-rdi-searchSearch controls
data-rdi-footerInspector footer
data-rdi-unstyledRoot opts out of default appearance
data-rdi-delimiterDecorative classic syntax: open, close, comma, quote, or index
data-rdi-closingDecorative closing line; use the same height and indentation as data rows
data-rdi-annotationSupplementary classic container notation
data-rdi-matchRow is a search match

These attributes identify semantic parts without guaranteeing a specific DOM hierarchy.

Stable state attributes

AttributeMeaning
data-typeInspected row's resolved type
data-depthZero-based display depth
data-expandedExpansion state, true or false
data-selectedSelection state, true or false
data-focusedNavigation focus state, true or false
data-rdi-presentationRoot presentation: inspector or classic
data-themeRoot theme preference
data-densityRoot density choice

Use logical CSS properties for RTL. Keep focus, selection, and search matching distinguishable: built-in styles outline focus, fill selection, and underline matches.

Unstyled responsibilities

unstyled retains behavior and attributes but removes default appearance. Application CSS must provide:

  • Tree overflow and row layout.
  • Uniform single-line row height when virtualization is enabled.
  • Logical indentation and readable type/value content.
  • Visible keyboard focus distinct from selection.
  • Usable controls, action feedback, and adequate contrast.

Set virtualization={false} when using wrapping or variable-height rows. Grouping and the visible-model limit remain active. Neither setting changes data inspection semantics.

The unstyled playground includes the complete design-system CSS and behavior. Use customization for choosing among CSS, slots, types, actions, and controlled state.

In classic mode, data-rdi-closing lines use the same uniform height as data-rdi-node rows. An unstyled virtualized integration must style both selectors; closing lines have --rdi-depth for indentation but contain no interactive controls.