
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
react-barcodes
Advanced tools
React hooks for generating Barcodes.
react-barcodes is available on npm. It can be installed with the following command:
npm install react-barcodes --save
react-barcodes is available on yarn as well. It can be installed with the following command:
yarn add react-barcodes
import React from 'react';
import { useBarcode } from 'react-barcodes';
function App() {
const { inputRef } = useBarcode({
value: 'react-barcodes',
options: {
background: '#ccffff',
}
});
return <svg ref={inputRef} />;
};
export default App;
import React from 'react';
import { useBarcode } from 'react-barcodes';
function App() {
const { inputRef } = useBarcode({
value: 'react-barcodes',
options: {
displayValue: false,
background: '#ffc0cb',
}
});
return <canvas ref={inputRef} />;
};
export default App;
import React from 'react';
import { useBarcode } from 'react-barcodes';
function App() {
const { inputRef } = useBarcode({
value: 'react-barcodes',
options: {
background: '#ffff00',
}
});
return <img ref={inputRef} />;
};
export default App;
Prop | Type | Require | Description |
---|---|---|---|
value | string | āļø | Text to generate. |
options | options | ā | Barcode options. |
Option | Type | Default | Require | Description |
---|---|---|---|---|
format | string? | auto | ā | Select which barcode type to use. Please check the wikipage of the different barcode types for more information. |
width | number? | 2 | ā | The width option is the width of a single bar. |
height | number? | 100 | ā | The height of the barcode. |
displayValue | boolean? | true | ā | |
text | string? | undefined | ā | Overide the text that is diplayed |
fontOptions | string? | "" | ā | With fontOptions you can add bold or italic text to the barcode. |
font | string? | "monospace" | ā | Define the font used for the text in the generated barcode. This can be any default font or a font defined by a @font-face rule. |
textAlign | string? | "center" | ā | Set the horizontal alignment of the text. Can be left / center / right . |
textPosition | string? | "bottom" | ā | Set the vertical position of the text. Can be bottom / top . |
textMargin | number? | 2 | ā | Set the vertical position of the text. Can be bottom / top . |
fontSize | number? | 20 | ā | Set the size of the text. |
background | string? | "#ffffff" | ā | Set the background of the barcode. |
lineColor | string? | "#000000" | ā | Set the color of the bars and the text. |
margin | number? | 10 | ā | Set the space margin around the barcode. If nothing else is set, all side will inherit the margins property but can be replaced if you want to set them separably. |
marginTop | number? | undefined | ā | |
marginBottom | number? | undefined | ā | |
marginLeft | number? | undefined | ā | |
marginRight | number? | undefined | ā | |
flat | boolean? | false | ā | Only for EAN8 / EAN13 |
If you think any of the react-barcodes
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.
We'd love to have your helping hand on contributions to react-barcodes
by forking and sending a pull request!
Your contributions are heartily ā” welcome, recognized and appreciated. (āæā āæā )
How to contribute:
FAQs
React hooks to generate Barcode.
The npm package react-barcodes receives a total of 3,057 weekly downloads. As such, react-barcodes popularity was classified as popular.
We found that react-barcodes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Ā It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600Ć faster than humans.