1.1.1 • Published 3 years ago

react-canvas-txt v1.1.1

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

React Canvas Txt

BCH compliance

A react typescript wrapper of geongeorge/Canvas-Txt

Install

yarn add react-canvas-txt

or

npm i react-canvas-txt

Usage

import ReactCanvasTxt from "react-canvas-txt";

<ReactCanvasTxt text="Hello World" />;

DEMO

https://codesandbox.io/s/cocky-benz-e4osd

Props

PropRequiredTypeNote
textyesstringThe text that will be drawn on the canvas
drawTxtPropsyesobjectThis object contain a properties for Canvas-Txt library
widthyesnumbercanvas width
heightyesnumbercanvas height

Library props

PropRequiredTypeNote
fontSizeyesnumberFont size of the text in px. This value cannot be 0
xyesnumberPosition of x for text in the canvas
yyesnumberPosition of y for text in the canvas
widthyesnumberWidth area for text in the canvas. This value cannot be 0
heightyesnumberHeight area for text in the canvas. This value cannot be 0
debugnobooleanShows the border and align gravity for debugging
alignno"center", "left", "right"Text align
vAlignno"middle", "top", "bottom"Text vertical align
fontnostringFont family of the text
fontStylenostringFont style, same as css font-style. Examples: italic, oblique 40deg
fontVariantnostringFont variant, same as css font-variant. Examples: small-caps, slashed-zero
fontWeightnostringFont weight, same as css font-weight. Examples: bold, 100
lineHeightnostring or nullLine height of the text, if set to null it tries to auto-detect the value
1.1.1

3 years ago

1.0.1

4 years ago