govil-html-description

111.0.6 • Public • Published

govil-html-description

A simply component written with TypeScript to insert HTML with React Variable Statements (JSX) using dangerouslySetInnerHTML and DOMPurify to sanitize it. adding allowed tags and attributes

How to use

Clone this repo to your local computer, then run:

  • npm install && npm run build

You can now import govil-html-description as a normal package installed from npm like so:

import Description from 'govil-html-description';
...

You can also import the type definitions if you're using TypeScript like so:

import Description, { IHtmlDescription } from 'govil-html-description'
...

Available props

interface IHtmlDescription {
    descriptionHtml: string;
}

To customise this component, pass in a viewModel to the vm prop.

// your-component.js
import Description from 'govil-html-description'

...
  <Description descriptionHtml={this.props.vm.description} />
...

This component was built for the benefit of the citizens of Israel on behalf of the government, but of course also for the benefit of the OpenSource community and freely published in npm

Readme

Keywords

none

Package Sidebar

Install

npm i govil-html-description

Weekly Downloads

2

Version

111.0.6

License

MIT

Unpacked Size

8.78 kB

Total Files

12

Last publish

Collaborators

  • chaimzlot