Skip to content

GhostFileUpload reference ​

Package: @ghostvue/vue. Status: experimental (stability policy).

Headless file picker with a removable File[] list. Browse and drop share one intake path that checks accept, maxFileSize, validate, and capacity in input order, appends accepted files, and reports each rejected file with a typed reason. Optional form participation through a visually hidden file input mirror (name, form, required, reset). Outcomes are announced through a polite live region. Client-side checks are UX, not a security control; consumers own uploads.

Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.

All component references

Props ​

NameTypeDefaultRequiredDescription
acceptstring—NoNative `accept` grammar: a picker hint that is also enforced on intake.
defaultValueFile[]"[]"NoUncontrolled seed and form-reset baseline, captured once at setup.
disabledbooleanfalseNoDisables the trigger, drops, and remove buttons, and omits the mirror from submit.
formstring—No`form` attribute for the mirror and the picker.
idstring—NoId of the trigger (the labelable control), not of the root element.
invalidbooleanfalseNoConsumer validity, combined with native constraint failure.
maxFilesnumber—NoTotal list capacity. Floored; not finite or below 1 is unlimited. `1` turns `multiple` off.
maxFileSizenumber—NoPer-file limit in bytes; equal is accepted. Not finite or negative is unset.
messagesPartial<GhostFileUploadMessages>—NoTyped, reactive overrides of announcement and label text.
modelValueFile[]—NoControlled list. `undefined` is uncontrolled; `[]` is a real empty value.
namestring—NoForm mirror `name`. Without it no mirror renders and nothing is submitted.
preventDocumentDropbooleantrueNoCancel file drags and drops outside every dropzone while an enabled dropzone is mounted.
requiredbooleanfalseNoNative `required` on the form mirror when `name` is set.
validateGhostFileUploadValidate—NoSynchronous, pure check after `accept` and `maxFileSize`; return a string to reject.

Emits ​

NamePayloadDescription
rejectGhostFileUploadRejection[]Once per intake batch with at least one rejection, after update:modelValue. Fires even when a controlled parent ignores the list update.

Models ​

PropEventTypeDescription
modelValueupdate:modelValueFile[]v-model for the File[] list. Every change emits a new array with the same File instances; the consumer array is never mutated.

Slots ​

NameDescription
defaultConsumer layout of the parts, with the list entries, rejections from the latest intake, remaining capacity, effective invalid state, and actions.

Slot props: default ​

NameTypeDescription
clear() => voidEmpties the list and `rejections`, and announces it.
clearRejections() => voidEmpties `rejections` without touching the list.
entriesreadonly GhostFileUploadEntry[]Current list with stable ids for `v-for` keys.
invalidbooleanEffective invalid state: `invalid` prop or native constraint failure.
openPicker() => voidOpens the native picker. No-op when disabled.
rejectionsreadonly GhostFileUploadRejection[]Rejections from the most recent intake only.
remainingnumber | undefined`maxFiles` minus list length, never below 0; `undefined` when unlimited.
remove(file: File) => voidRemoves the first identical entry and applies the focus rule.

Exposed members ​

NameTypeDescription
blur() => voidBlurs the trigger.
clear() => voidSame as the slot `clear`.
elementHTMLElement | nullThe root element.
focus(options?: FocusOptions) => voidFocuses the trigger.
openPicker() => voidOpens the native picker; call inside a user gesture.

Parts and data attributes ​

AttributeValueDescription
data-partrootState owner element (div). Internal picker, form-input mirror, and announcer are not styling hooks.
data-stateinvalidinvalid prop or native required failure from the mirror. Wins over disabled.
data-statedisabledRoot is disabled.

CSS variables ​

None declared.

Accessibility ​

Role: generic. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/button/.

Required ARIA attributes: none.

Keyboard ​

None declared.

Verification ​

Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.

CategoryStatusEvidence
Automated keyboardNot reviewedNo declared key is mapped to a browser test yet.
Manual interactionNot reviewedNo review recorded.
Assistive technologyNot reviewedNo review recorded.

Examples ​

file-upload/basic ​

Example source

Basic Headless

Dropzone, trigger, and a removable file list.

Drag files here, or

file-upload/button-only ​

Example source

Button only Headless

Trigger and list without a drop target.

file-upload/field ​

Example source

Field Headless

Inside GhostField with a visible error built from rejections.

Drag PDF files here, or

file-upload/validation ​

Example source

Validation Headless

accept, maxFileSize, and maxFiles with visible rejection messages.

PNG, JPEG, or WebP. Up to 1 MB each, 3 files.

Drag images here, or

3 of 3 remaining

file-upload/duplicates ​

Example source

Duplicates Headless

A validate callback that rejects files already in the list.

file-upload/controlled ​

Example source

Controlled Headless

v-model with a synchronous parent update, a clear action, and a disabled toggle.

Drag files here, or

0 selected

file-upload/form ​

Example source

Form Headless

Native form with FormData from the mirror, required, and reset.

Documents (required)