1.1.1 ā€¢ Published 4 years ago

@createnextapp/react-barcode v1.1.1

Weekly downloads
1,606
License
MIT
Repository
github
Last release
4 years ago

react-barcode

React component to generate Barcode.

šŸŽ Features

  • Compatible with both JavaScript and TypeScript
  • Generate as SVG, Canvas and Image
  • Support multiple barcodes type

Barcodes Type

šŸ”§ Install

react-barcode is available on npm. It can be installed with the following command:

npm install --save @createnextapp/react-barcode

react-barcode is available on yarn as well. It can be installed with the following command:

yarn add @createnextapp/react-barcode

šŸ’” Usage

SVG

import React from 'react';
import { useBarcode } from '@createnextapp/react-barcode';

function App() {
  const { inputRef } = useBarcode({
    value: 'createnextapp',
    options: {
      background: '#ccffff',
    }
  });
  
  return <svg ref={inputRef} />;
};

export default App;

Canvas

import React from 'react';
import { useBarcode } from '@createnextapp/react-barcode';

function App() {
  const { inputRef } = useBarcode({
    value: 'createnextapp',
    options: {
      displayValue: false,
      background: '#ffc0cb',
    }
  });
  
  return <canvas ref={inputRef} />;
};

export default App;

Image

import React from 'react';
import { useBarcode } from '@createnextapp/react-barcode';

function App() {
  const { inputRef } = useBarcode({
    value: 'createnextapp',
    options: {
      background: '#ffff00',
    }
  });
  
  return <img ref={inputRef} />;
};

export default App;

Parameters

Options

šŸ’– Wrap Up

If you think any of the react-barcode can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

šŸŒŸ Contribution

We'd love to have your helping hand on contributions to react-barcode by forking and sending a pull request!

Your contributions are heartily ā™” welcome, recognized and appreciated. (āœæā— ā€æā— )

How to contribute:

  • Open pull request with improvements
  • Discuss ideas in issues
  • Spread the word
  • Reach out with any feedback

āš–ļø License

The MIT License License: MIT