Axonpack

Installation

One install, no native module, and the components you already have.

npm install @axonpack/react-pretty-print

React 18 or newer is the only peer dependency. There is no native module, so there is no pod install and no prebuild, and it runs in Expo Go.

The build is made for a bundler such as Metro, webpack or Vite. Plain Node can't import it, so a script that runs outside one can't use it either.

On the web

domPrimitives ships with the package, so there is nothing to write.

import { CodeHighlight, JsonTree, XmlTree, domPrimitives } from '@axonpack/react-pretty-print';
import { LIGHT_THEME } from '@axonpack/react-pretty-print/themes';

const Example = () => (
  <>
    <JsonTree primitives={domPrimitives} value={response} theme={LIGHT_THEME} />
    <XmlTree primitives={domPrimitives} source={feed} theme={LIGHT_THEME} />
    <CodeHighlight primitives={domPrimitives} code={src} language="typescript" theme={LIGHT_THEME} />
  </>
);

On React Native

React Native's own components satisfy the contract as they are.

import { Pressable, Text, View } from 'react-native';
import { JsonTree } from '@axonpack/react-pretty-print';

const Example = () => <JsonTree primitives={{ View, Text, Pressable }} value={response} />;

Every shipped palette asks for monospace, which is an Android family name. iOS finds no font by it and falls back to the proportional system font without warning. See Themes for the one-line override.

Entry points

ImportHolds
@axonpack/react-pretty-printThe three renderers, domPrimitives, and every utility
@axonpack/react-pretty-print/themesThe 130 palettes and the PrettyPrintTheme type

Give your AI agent the skill

If you work with a coding agent, install the Axonpack skill into the project:

npx skills add axonpack/skills

Then you can ask it to "Set up @axonpack/react-pretty-print in this app", and it follows this page from the live docs. Agent skill has the command for each package manager.

On this page