Documentos
Overview
A generic document CRUD screen, built on MeDocumentView as the chassis, MeHeader for top navigation, and MeButtonBar for toolbar actions. Unlike Transações — one page per screen — this template is a single component driven entirely by data: every field is a DocumentField rendered as plain text, grouped into DocumentFormSection/DocumentFormSubsection, and every section declares what its body is. This page documents the chassis in read mode, the mode every document page below ships in.
Every section is on the page at once: there is no step-by-step wizard, and the section strip is an anchor strip rather than tabs, so nothing is ever hidden behind it. That strip is off by default and the preview below leaves it off: a document knows whether it is long enough to want one, the chassis does not.
The preview below runs on a neutral fixture, not on any real document type. That is deliberate: the chassis is what is being documented here, and a page that illustrated itself with one concrete document would quietly turn that document into the definition of the chassis.
Unlike the other templates, the chassis is the reusable piece: you import MeDocument from the package and hand it a payload. What changes from one document to the next is the data, never the component. See Document for the payload reference.
Section kinds
A section declares what its body is through kind. Without one it is the field grid. Every other kind mounts a published block with the data the section carries for it, and the chassis owns the padding around them: one rule for every document.
kind | Data on the section | Renders |
|---|---|---|
fields (default) | fields, subsections | MeFieldGrid |
table | table, selectable | MeDocumentTable |
items | items (columns, items, actions, toggle, massActions, expandAll, pinActions), totals | MeDocumentItems, the section's action bar, MeDocumentTotals |
approval | history, currentState | MeApprovalHistory, with the current state beside the title |
attachments | attachments | MeDocumentAttachments |
totals | totals | MeDocumentTotals |
cards | cards | a wrapping row of MeInfoCard |
empty | message | MeDocumentSectionEmpty |
tabs | tabs ([{ id, label, ...any kind's data }]) | UTabs under the header, each tab's body rendered by the same rule as a section |
Every section can also carry description (a muted line under the title), footer (a sentence, a dot legend, or both) and empty (starts collapsed; derived from the kind's rows when omitted). count is derived from the rows too. The component escape hatch stays for a section that is not data, such as an embed.
The Forehead is data as well: document.identity draws the leading column as an identity block (role, title with its chat and edit controls, labelled facts, the issuing user with its chat control and an optional note, the address with its map link); subNumber prints a second identifier under the number in the badge; trailingFacts, progressLabel and steps complete the trailing column and the drawer.
Read
document and the modelValue payload from its own data source, typically a page generator.Any document is a payload
A document is not a template of its own: it is a DocumentMeta for the Forehead, a DocumentFormData for the sections and the party cards, and a DocumentToolbarProps for the bar, handed to MeDocument. Everything specific to a Pré-Pedido, a Pedido or a Nota Fiscal (section ids and labels, which kinds they use, the parties, the alerts) lives in that payload, which is what a page generator produces. The chassis knows none of it.
Ejecting
If this is the first thing you're ejecting into this project, do the one-time setup first.
npx shadcn-vue@latest add @mercadoeletronico/document
Read also ships as its own registry:page item, a page already wired for the mode:
npx shadcn-vue@latest add @mercadoeletronico/document-read
It lands at ~/pages/document-read.vue and is deliberately thin: it pins mode, supplies the document metadata and hands over a payload. The command at the top of this section ejects the chassis alone, as a registry:block under ~/components/document/, for when you would rather wire the modes yourself.