0.5.0 • Published 2 years ago

@hirohe/react-watermark v0.5.0

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

React Watermark Component

version

A React Component to wrap watermark text on child component, using generated svg as background-image

Doc

Storybook

Usage:

this Component requires react version >=16.8.0, in order to use the react hook feature

yarn add @hirohe/react-watermark
# or
npm i --save @hirohe/react-watermark

e.g.

import { Watermark } from '@hirohe/react-watermark';

const ContentWithWatermark = () => (
  <Watermark text="Mark">
    <div style={{ width: 500, height: 500, backgroundColor: '#5f5f5f' }}>
      Lorem ipsum
    </div>
  </Watermark>
)

example

Props

propdescriptiontypedefault
showshow watermark or notbooleantrue
textwatermark textstring-
textColorcolor of watermarkcolor string#cccccc
textSizewatermark text size in px unitnumber24
fontFamilywatermark text font-familystringArial, Helvetica, sans-serif
lineHeightwatermark text lineHeightstring'1.2rem'
multilinewhether text is multiline or notbooleanfalse
opacitywatermark text opacitynumber0.2
rotatewatermark text rotate degreenumber-45
guttergutter between watermark textnumber0
wrapperStylestyle of wrapperCSSProperties-
wrapperElementelement of wrapperReact.ElementType'div'

TODO

  • multiline watermark text
  • adjustable space between watermark

License

MIT License. See LICENSE.txt for more information.