@ivvitikhonov/react-xml-viewer
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

@ivvitikhonov/react-xml-viewer

NPM

xml-react-viewer

Install

npm install --save @ivvitikhonov/react-xml-viewer

Usage

import * as React from "react";

import { XmlViewer } from "@ivvitikhonov/react-xml-viewer";

const xml = "<hello>World</hello>";

export const App = () => <XmlViewer xml={xml} />;

Props

Name Type Default Required Description
xml string Yes The XML to display. XML should have UTF-8 character encoding, other encodings are not supported
collapsible boolean true No Whether the tree start as collapsed or not
indentSize number 4 No The number of spaces to indent each level
theme object undefined No The theme to use. When undefined, it uses the standard theme

Theme

Name Type Default Description
attributeKeyColor string "#2a7ab0" Set the attribute key color (<tag attribute-key="hello" />)
attributeValueColor string "#008000" Set the attribute value color ( <tag attr="Attribute value">)
cdataColor string "#1d781d" Set the cdata element color (<![CDATA[some stuff]]>)
collapseIndicatorColor string "#ae2c4c" Set the collapse indicator color (+/-)
commentColor string "#aaa" Set the comment color (<!-- this is a comment -->)
separatorColor string "#333" Set the separators colors (<, >, </, />, =, <?, ?>)
tagColor string "#d43900" Set the tag name color (<tag-name />)
textColor string "#333" Set the text color (<tag>Text</tag>)
overflowBreak boolean false Adjust the xml to fit in the parent width without overflowing

Acknowledgement

This XML Viewer is based on react-xml-viewer, see the original here.

License

MIT © ivvitikhonov

Package Sidebar

Install

npm i @ivvitikhonov/react-xml-viewer

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

959 kB

Total Files

23

Last publish

Collaborators

  • ivvitikhonov