Skip to content

Getting Started

Terminal window
npm install inspect-value

Or with other package managers:

Terminal window
pnpm add inspect-value
yarn add inspect-value
bun add inspect-value
<script type="module" src="https://unpkg.com/inspect-value"></script>
<inspect-value id="demo"></inspect-value>
<script>
document.getElementById('demo').value = {
hello: 'world',
items: [1, 2, 3],
nested: { deep: true },
};
</script>
import 'inspect-value';

That single import registers both <inspect-value> and <inspect-panel> as custom elements. Then use them in your templates.

The value prop accepts any JavaScript value — objects, arrays, Maps, Sets, Promises, etc. Because HTML attributes can only hold strings, you must set complex values via the DOM property:

const el = document.querySelector('inspect-value');
el.value = { anything: 'goes here', map: new Map() };

Each framework has its own idiomatic way of doing this — see the framework guides.

Styles are fully encapsulated inside the Shadow DOM. The component won’t leak styles into your page and your page styles won’t affect the inspector.

Set the theme attribute or property to switch between built-in themes:

<inspect-value theme="drak"></inspect-value>

Available themes: inspect (default), drak, stereo, dark, default-dark, default-light.

Enable the built-in search bar by setting the search property:

el.search = 'filter'; // hide non-matching nodes
el.search = 'filter-strict'; // hide non-matching leaves
el.search = 'highlight'; // highlight matches, show all

<inspect-panel> provides a fixed-position overlay panel, ideal for persistent state inspection during development:

<inspect-panel open position="bottom-right"></inspect-panel>

See the full API reference for all available props.