# react-datamatrix-svg

> React component wrapper for github datamatrix js

Latest version **1.0.7** (published 2022-11-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-datamatrix-svg
pnpm add react-datamatrix-svg
yarn add react-datamatrix-svg
bun add react-datamatrix-svg
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2022-11-14 |
| First published | 2022-11-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 51.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Levi Gonzales |
| Maintainers | lvstross |

## Links

- npm: https://www.npmjs.com/package/react-datamatrix-svg
- Repository: https://github.com/lvstross/react-datamatrix
- Homepage: https://github.com/lvstross/react-datamatrix#readme
- Issues: https://github.com/lvstross/react-datamatrix/issues
- npm.io page: https://npm.io/package/react-datamatrix-svg

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0

## Recent versions

- 1.0.7 (latest) — 2022-11-14
- 1.0.6 — 2022-11-11
- 1.0.5 — 2022-11-11
- 1.0.4 — 2022-11-11
- 1.0.3 — 2022-11-11
- 1.0.2 — 2022-11-11
- 1.0.1 — 2022-11-11
- 1.0.0 — 2022-11-11

## README

# React DataMatrix SVG

A React component wrapper for [datamatrix-svg](https://github.com/datalog/datamatrix-svg)

<img src="https://github.com/lvstross/react-datamatrix/blob/main/public/assets/datamatrix-svg.jpg?raw=true" width="150px" height="150px" />

## Installation
    npm install react-datamatrix-svg

## Usage

```javascript
import React from 'react'
import DataMatrix from 'react-datamatrix-svg'

const App = () => {
    return (
        <DataMatrix msg="Hello World" dim={50} />
    )
}

export default App
```

## Full Usage

```javascript
import React from 'react'
import DataMatrix from 'react-datamatrix-svg'

const App = () => {
    return (
        <DataMatrix
            msg="Hello World"
            dim={50}
            rct={1}
            pad={10}
            pal={["#000", "#fff"]}
            vrb={1}
            imgAttrs={{
                alt: 'Alt text for image'
            }}
        />
    )
}

export default App
```

## Props
| Name | Type | Required | Description |
|:---:|:---|:---:|:---|
| msg | string | Yes | Any string to be encoded. |
| dim | number | No  | is equal to needed dimention (height) in pixels, default value is `256`. |
| rct | number | No  | set 1 to render rectangle Data Matrix if possible, default value is `0`. |
| pad | number | No  | white space padding, default value is `2` blocks, set `0` for no padding. |
| pal | string[] | No | is array of [`color`,`background-color`] strings that represent hex color codes, default value is [`'#000'`] along with transparent background. Set [`'#000'`,`'#fff'`] to make background opaque.
| vrb | number | No | svg node is optimized to be compact and default value is `0`, set this parameter to `1` in case you need more verbose output. |
| imgAttrs | ImgHTMLAttributes | No | Any `<img>` attributes you would like to pass down to the image rendering the svg. |

---
_Source: https://npm.io/package/react-datamatrix-svg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
