Developers · Gutenberg

Barcode Generator block for WordPress

Generate Code128 barcodes from any text or number. Customize bar height, width, colors, and download as PNG.

Get Blockenberg

Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.

Get Blockenberg

What it actually does

Generate Code128 barcodes from any text or number. Customize bar height, width, colors, and download as PNG.

Inspector panels on this block: Content, Barcode Settings. Those titles come from index.js, not from a shared template.

Where to find it

Gutenberg inserter → Developers → search “Barcode Generator” (block name `blockenberg/barcode-generator` in block.json). Style it in the sidebar after insert.

How to use Barcode Generator block for WordPress

  1. Install Blockenberg. Install from WordPress.org and activate the plugin.
  2. Insert the block. Edit a page, click +, search for “Barcode Generator”, insert it. Category: Developers.
  3. Configure inspector controls that exist on this block. Open Content. Set “Default Text / Number”, “Bar Height (px)”, “Bar Width Multiplier”, “Show Text Label”.
  4. Check the published page. The view script reads HTML data attributes: data-opts. The block editor preview may not run the same view script.

Inspector controls from this block’s code

ControlWhat the code does
Default Text / NumberText field in the inspector. block.json default: BLOCKENBERG-2024. Saved as `defaultText`.
Bar Height (px)Numeric range control in the inspector. Range 30–200. block.json default: 80. Saved as `barHeight`.
Bar Width MultiplierNumeric range control in the inspector. Range 1–5. block.json default: 2. Saved as `barWidth`.
Show Text LabelOn/off toggle in the inspector. On by default. Saved as `showLabel`.
Show Download ButtonOn/off toggle in the inspector. On by default. Saved as `showDownload`.
Show Copy ButtonOn/off toggle in the inspector. On by default. Saved as `showCopy`.
Typography — TitleShared Blockenberg typography popover (family, size, weight, spacing). Saved as `titleTypo`.
SubtitleShared Blockenberg typography popover (family, size, weight, spacing). Saved as `subtitleTypo`.
Accent ColorColor control in the inspector. block.json default: #1f2937. Saved as `accentColor`.
Bar ColorColor control in the inspector. block.json default: #000000. Saved as `barColor`.
Barcode BackgroundColor control in the inspector. block.json default: #ffffff. Saved as `bgColor`.
Section BackgroundColor control in the inspector. block.json default: #f9fafb. Saved as `sectionBg`.
Title ColorColor control in the inspector. block.json default: #111827. Saved as `titleColor`.
Button ColorColor control in the inspector. block.json default: #1f2937. Saved as `buttonBg`.

What the front-end script actually does

When this is the right block

Notes from the implementation

viewScript: this folder’s frontend.js is enqueued on the front end for this block.

FAQ

How do I add the Barcode Generator block in WordPress?

Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Barcode Generator”. It sits under Developers. After insert, open Content and set “Default Text / Number”, “Bar Height (px)”, “Bar Width Multiplier”, “Show Text Label”.

Does Barcode Generator need a server or extra plugin?

No. After Blockenberg is active, the view script runs in the browser with the values you saved on the block.

Is the Barcode Generator Gutenberg block free?

Yes. Barcode Generator ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.

Can I style Barcode Generator to match my theme?

Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Content, Barcode Settings).

Related developers blocks

Get Blockenberg

Install Blockenberg from WordPress.org, then insert Barcode Generator from the Gutenberg inserter.

Get Blockenberg