Skip to content

Latest commit

 

History

History

html-measure

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

html-measure

NPM version NPM Downloads

Make html to be measurable written by React

Installation

npm install html-measure
# or use yarn
yarn add html-measure

Usage

import HtmlMeasure from 'html-measure'
import 'html-measure/style.css'
// or
import 'html-measure/style.less'

ReactDOM.render(<HtmlMeasure html="<div>foo</div>" />, window.root)

Props

className

  • Type: string

style

  • Type: object

html

  • Type: string

unit

  • Type: one of 'px' | 'rem'
  • Default: 'px'

remStandardPx

  • Type: number
  • Default: 16

scaleGapPx

The size of the red rect in the above picture.

  • Type: number
  • Default: 10

isShowUnit

  • Type: boolean
  • Default: true

isCalcContainerWidth

  • Type: boolean
  • Default: true

numberFixed

  • Type: number
  • Default: 0

Authors

This library is written and maintained by imcuttle, moyuyc95@gmail.com.

License

MIT