1.0.5 • Published 3 years ago

@ivvitikhonov/react-xml-viewer v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@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

NameTypeDefaultRequiredDescription
xmlstringYesThe XML to display. XML should have UTF-8 character encoding, other encodings are not supported
collapsiblebooleantrueNoWhether the tree start as collapsed or not
indentSizenumber4NoThe number of spaces to indent each level
themeobjectundefinedNoThe theme to use. When undefined, it uses the standard theme

Theme

NameTypeDefaultDescription
attributeKeyColorstring"#2a7ab0"Set the attribute key color (<tag attribute-key="hello" />)
attributeValueColorstring"#008000"Set the attribute value color (<tag attr="Attribute value">)
cdataColorstring"#1d781d"Set the cdata element color (<![CDATA[some stuff]]>)
collapseIndicatorColorstring"#ae2c4c"Set the collapse indicator color (+/-)
commentColorstring"#aaa"Set the comment color (<!-- this is a comment -->)
separatorColorstring"#333"Set the separators colors (<, >, </, />, =, <?, ?>)
tagColorstring"#d43900"Set the tag name color (<tag-name />)
textColorstring"#333"Set the text color (<tag>Text</tag>)
overflowBreakbooleanfalseAdjust 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

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago