Adds label templates, media and print log collections to Payload, plus an admin template editor and a print dialog on documents. Labels are filled from document fields and output as SVG or PDF, with barcodes, QR and Data Matrix drawn as vectors. Requires Payload 3.80 or newer, @payloadcms/ui and React 19, and you must configure access rules for managing and printing.
Labels for Payload: design labels with field tokens, then print one, a few or every label for a document on thermal rolls or Avery-style sheets.
Installation
npm i @extantape/payload-plugin-labels0
Stars
0
Forks
0
Open Issues
1 weeks ago
Last Updated
146
Weekly Downloads
v0.1.0
npm Version
136.5 KB
Unpacked Size
2
Dependencies
00 since Nov 8
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
186+23 since Nov 23
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 186 |
| Dec 4, 2026 | 358 |
| Dec 3, 2026 | 402 |
| Dec 2, 2026 | 434 |
| Dec 1, 2026 | 431 |
| Nov 30, 2026 | 574 |
| Nov 29, 2026 | 547 |
| Nov 28, 2026 | 498 |
| Nov 27, 2026 | 318 |
| Nov 26, 2026 | 247 |
| Nov 25, 2026 | 198 |
| Nov 24, 2026 | 163 |
| Nov 23, 2026 | 163 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1453468532-root)<a href="https://payloaddirectory.dev/plugins/1453468532-root"><img src="https://payloaddirectory.dev/badge/1453468532-root.svg" alt="Payload Directory"></a>README
Labels for Payload: design labels with field tokens in the admin, then print one, a few or every label for a document, on thermal rolls or Avery-style sheets.
Status: early, version 0.1.0, the first version on npm. Built and tested (124 tests): the layout engine in src/core (field tokens, text fitting, barcode value checks, sheet grid positions, the 4 x 6 inch thermal preset), and the plugin that adds the three collections with write access closed by default and scope filtering on reads and writes, plus SVG and PDF output drawn from the layout marks, with barcodes, QR and Data Matrix as vectors (bwip-js), and the print endpoint POST /api/labels/print, which also prints sets (see Sets below; tested on in-memory MongoDB with made-up data, not with a real kits collection). The scope rules are tested against an in-memory MongoDB with two made-up sites. The PDF was checked for page count and page size in points, not opened in a printer or viewer; the SVG was checked as text, not in a browser; no barcode has been scanned. The endpoint is tested by calling its handler against an in-memory MongoDB, not over HTTP. Images (PNG and JPEG from allowed local upload collections) are drawn in SVG and PDF, and pruneLabelPrints enforces the log's retention when the site schedules it; both are tested on in-memory MongoDB, not with cloud storage or a scheduled job. The admin editor (layers list, inspector, live preview) is tested in jsdom only: it has not been seen in a real browser, with a screen reader, or inside the Payload admin. Sheet pages (Avery 5160 and 5163 presets, stored sheet media, a start slot) are built and checked for page count and page size, but the preset measurements come from published sizes and have not been checked on a printed sheet. A print button and dialog (template, media, start-slot grid, copies) are built and tested in jsdom with a mocked fetch; they have not been seen in a real Payload admin or used with a screen reader. Not built yet: the drag-and-drop canvas and remembering the last media per person. The design is in docs/design.md.
The print log keeps entries for 180 days by default (log.keepDays; 0 keeps them forever). Nothing deletes old entries on its own. Retention only runs when your site schedules pruneLabelPrints(payload), for example as a Payload job or a cron call. If you don't schedule it, the log grows without limit.
{{order.customer.name}} fill them from the document, so labels always carry live data.The pairings are still the plan from docs/design.md.
On its own: Labels works on any Payload site with no other plugin. You design labels in the admin from your own collections' fields, and print them from each document.
Needs: Payload ^3.80.0, @payloadcms/ui ^3.80.0 and React ^19.0.0 as peer dependencies. No other EXTANT APE plugin is required.
Works with (planned for 0.3, each through config.custom.labels.providers, with no import either way):
adapters.labels is already typed for this.Color Theory: no direct link. The template editor and print dialog use Payload's --theme-* colors, so they follow Color Theory's admin colors when its applyToAdmin option is on. Printed labels keep the colors you design.
Family: Labels sits in the Fulfillment family, with Kitting, Restock, Sample Kits, Shipping, Scan, Wizards, Custody and Sequences, though the families are a working draft and Fulfillment is due to be split into different groups.
The elements field of a template uses an editor from @extantape/payload-plugin-labels/client (set up by the plugin; the site needs react and @payloadcms/ui, and the admin import map regenerated). It has three parts: a layers list (arrow keys move the selection; buttons move a layer up or down, hide it from the preview, or delete it; each result is announced), a preview drawn from the same layout as printing, and an inspector for the selected layer (position and size in mm, rotation, text and tokens, font size, fit rule, barcode type and value). A sample record, edited as JSON, fills the tokens, and a warnings list names the layer for each missing value, text that does not fit and bad barcode value. Hiding a layer affects the preview only and is not saved. The label's width and height come from the template's own fields. Placing layers by dragging comes later.
Not published yet. It will be @extantape/payload-plugin-labels on npm. To build it here: npm install, npm test, npm run build.
import { labelsPlugin } from '@extantape/payload-plugin-labels'
export default buildConfig({
plugins: [
labelsPlugin({
access: {
manage: ({ req }) => req.user?.role === 'admin',
print: ({ req }) => Boolean(req.user?.canPrint),
},
// Per site: scopeField: 'tenant', scopeCollection: 'tenants',
// scopeOf: ({ req }) => (req.user?.role === 'platform' ? ALL_SCOPES : req.user?.tenant),
}),
],
})
You must set access.manage (who may change templates and media), access.print (who may print), or both. With neither, the plugin throws when the config loads and names the missing option. Nobody is allowed by default. Only an answer of exactly true passes. Templates and media can be read by people the manage or print check allows, and the print log only by manage. With scopeField, you also give scopeOf, which says which site the person belongs to (an id, ALL_SCOPES for a platform admin, or nothing). A person reads and writes only their own site's templates, media and print log, and can also read templates with no site, which only a platform admin can change. No site, an error or no sign-in means no access. A record cannot be moved to another site.
The layout engine works on its own, with no Payload and no React: import { layout, THERMAL_4X6 } from '@extantape/payload-plugin-labels/core'. layout(template, record, media) returns the marks of one label in millimeters, plus warnings for missing values, text that does not fit and marks outside the label. Text width is estimated from character counts, so fitting is approximate.
Printing: POST /api/labels/print with { "template": "<key or id>", "ids": [...], "copies": 1 } returns a PDF, one label per page. It needs a signed-in person with the print check (or, with no print check, the manage check), a scope when scopeField is set, a template in their scope, and read access to every document through Payload's own rules for that collection. If any document is missing or unreadable, nothing prints. A request over 2,000 labels (documents times copies) is refused with its count. Each print writes one log entry with the template, collection, document ids, label count and who printed, and never the label text, plus the media key and, for sheets, the start slot (1 when none was given). If the log write fails, nothing is returned. The 4 x 6 in thermal media is used for every template for now.
Output: renderSvg(layoutResult) (in /core) gives an SVG in millimeters for previews. renderPdf([layoutResult, ...]) from @extantape/payload-plugin-labels/pdf gives a PDF with one label per page, each page the label's size. Both draw the same marks. Images draw as a placeholder box for now.
A set prints several kinds of label from one starting record, such as the shipping box label for an order and the bag and box labels for each of its kits. Sets live in the label-sets collection, with the same site scope and access rules as templates: people who may manage change them, and people who may print can read them.
A set has a key, the collection its starting record comes from, and a list of steps. Each step names a template and says how its records are reached:
self): the starting record, or the records of an earlier step.forward): follow a relationship field from those records. field is a path of up to 4 relationship fields joined with dots, such as kit.bag.backward): find records in another collection whose relationship field points at those records, such as the items whose order field names this order.A step starts from the starting record unless from names an earlier step (1 is the first). Each step's template must print from the collection that step reaches.
A media key is optional. A real key must be unique across the whole collection, whatever the site, and cannot be a built-in media name. Saving a second media with the same key is refused with a plain message. An empty or blank key counts as no key, and any number of media can have none. The check is a read before the write, so two saves at the same instant could both pass. If you installed an earlier build, drop the old unique index on key in label-media (Mongo: db['label-media'].dropIndex('key_1')).
Select all across pages: on a list view, select every row on the page and the print dialog offers "Select all N matching". The request then carries { "template": "<key or id>", "match": { "collection": "orders", "where": { ... }, "sort": "-createdAt" } } instead of ids. The server runs that filter as the person, so their read access decides what is found, and prints every match in the list's order. The 2,000-label cap applies to matches times copies and is checked before anything is read, with the same message as ids. match and ids cannot be sent together, match does not work with sets, and a filter that matches nothing is refused.
Print a set with POST /api/labels/print and { "set": "<key or id>", "id": "<starting record id>", "copies": 1 }. media and start work as they do for a template. Labels come out in step order. Every record is read as the person, and if any record the set reaches is missing or hidden from them, nothing prints. That includes a backward step where some matching records exist but the person may not read them. The 2,000-label cap counts every label in the set, copies included. The print log records the set with the starting record.
Only put a step in a set for things that really get one of your labels. Sample tubes, for example, carry the manufacturer's label, so a kit's set prints the shipping box, bag and box labels and never one for a tube.
MIT. See LICENSE.
payload barcodes
Barcodes and QR codes for Payload ecommerce products with a printable label page and no runtime dependencies
709/wk1v3
payload plugin scan
Read barcodes and QR codes by camera or USB scanner, and resolve scan links by signed-in user without allowing probing
76328/wk0v3
payload invoices
Gapless sequential invoices and credit notes for Payload ecommerce orders with frozen snapshots and built-in PDF output
6919/wk1v3
payload plugin
Short links on your own domain for Payload documents that keep working after slug changes
518/wk1v3 v4
payload invoicepdf
Invoice and quote collections with JSX-based PDF generation, email sending and quote acceptance links
459/wk9v3
payload plugin thirds render
Render Payload documents to PDF or images through the API and save them in an upload collection
300v3