GhostFileUpload reference
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed wrappers around headless GhostFileUpload, GhostFileUploadDropzone, GhostFileUploadTrigger, GhostFileUploadList, and GhostFileUploadItemRemove; GhostFileUploadItem and useGhostFileUpload are re-exported unchanged. Importing from @ghostvue/themes loads ghost-file-upload.css: token-based dropzone with idle, hover, dragging, invalid, and disabled states, a neutral trigger and quiet remove buttons sized from the control scale (at least 44px on coarse pointers) with a visible focus ring, bordered list items, motion only when reduced motion is not requested, and forced-colors support. Rules key on data-themed, so headless parts stay unstyled.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
accept | string | — | No | Native `accept` grammar: a picker hint that is also enforced on intake. Forwarded to headless GhostFileUpload. |
defaultValue | File[] | "[]" | No | Uncontrolled seed and form-reset baseline, captured once at setup. Forwarded to headless GhostFileUpload. |
disabled | boolean | false | No | Disables the trigger, drops, and remove buttons, and omits the mirror from submit. Forwarded to headless GhostFileUpload. |
form | string | — | No | `form` attribute for the mirror and the picker. Forwarded to headless GhostFileUpload. |
id | string | — | No | Id of the trigger (the labelable control), not of the root element. Forwarded to headless GhostFileUpload. |
invalid | boolean | false | No | Consumer validity, combined with native constraint failure. Forwarded to headless GhostFileUpload. |
maxFiles | number | — | No | Total list capacity. Floored; not finite or below 1 is unlimited. `1` turns `multiple` off. Forwarded to headless GhostFileUpload. |
maxFileSize | number | — | No | Per-file limit in bytes; equal is accepted. Not finite or negative is unset. Forwarded to headless GhostFileUpload. |
messages | Partial<GhostFileUploadMessages> | — | No | Typed, reactive overrides of announcement and label text. Forwarded to headless GhostFileUpload. |
modelValue | File[] | — | No | Controlled list. `undefined` is uncontrolled; `[]` is a real empty value. Forwarded to headless GhostFileUpload. |
name | string | — | No | Form mirror `name`. Without it no mirror renders and nothing is submitted. Forwarded to headless GhostFileUpload. |
preventDocumentDrop | boolean | true | No | Cancel file drags and drops outside every dropzone while an enabled dropzone is mounted. Forwarded to headless GhostFileUpload. |
required | boolean | false | No | Native `required` on the form mirror when `name` is set. Forwarded to headless GhostFileUpload. |
validate | GhostFileUploadValidate | — | No | Synchronous, pure check after `accept` and `maxFileSize`; return a string to reject. Forwarded to headless GhostFileUpload. |
Emits
| Name | Payload | Description |
|---|---|---|
reject | GhostFileUploadRejection[] | Once per intake batch with at least one rejection, after update:modelValue. Fires even when a controlled parent ignores the list update. |
Models
| Prop | Event | Type | Description |
|---|---|---|---|
modelValue | update:modelValue | File[] | v-model for the File[] list. Every change emits a new array with the same File instances; the consumer array is never mutated. |
Slots
| Name | Description |
|---|---|
default | Consumer layout of the parts, with the list entries, rejections from the latest intake, remaining capacity, effective invalid state, and actions. |
Slot props: default
| Name | Type | Description |
|---|---|---|
clear | () => void | Empties the list and `rejections`, and announces it. |
clearRejections | () => void | Empties `rejections` without touching the list. |
entries | readonly GhostFileUploadEntry[] | Current list with stable ids for `v-for` keys. |
invalid | boolean | Effective invalid state: `invalid` prop or native constraint failure. |
openPicker | () => void | Opens the native picker. No-op when disabled. |
rejections | readonly GhostFileUploadRejection[] | Rejections from the most recent intake only. |
remaining | number | undefined | `maxFiles` minus list length, never below 0; `undefined` when unlimited. |
remove | (file: File) => void | Removes the first identical entry and applies the focus rule. |
Exposed members
| Name | Type | Description |
|---|---|---|
blur | () => void | Blurs the trigger. |
clear | () => void | Same as the slot `clear`. |
element | HTMLElement | null | The root element. |
focus | (options?: FocusOptions) => void | Focuses the trigger. |
openPicker | () => void | Opens the native picker; call inside a user gesture. |
Parts and data attributes
| Attribute | Value | Description |
|---|---|---|
data-part | root | Grid stack of the consumer's parts with data-themed. |
data-part | dropzone | Dashed surface; solid primary border while dragging. |
data-part | trigger | Neutral action button one medium control tall (at least 44px on coarse pointers), with a focus ring. |
data-part | list | Unstyled-marker grid; styles its direct item children. |
data-part | item | Bordered row (headless part, styled through the list's child combinator). |
data-part | item-remove | Quiet button at the item's inline end, one small control tall (at least 44px on coarse pointers), with a focus ring. |
data-state | dragging | Dropzone while a file drag is over it. |
data-state | invalid | Danger border with doubled width on the dropzone and trigger. |
data-state | disabled | Disabled tokens on the trigger; reduced opacity on the dropzone. |
data-themed | present | Present on every wrapped file upload part. |
CSS variables
| Name | Description |
|---|---|
--ghost-control-touch-min | Sets the dropzone's minimum block size (three touch targets tall). |
--ghost-control-size-md-min | Minimum block and inline size of the trigger. |
--ghost-control-size-sm-min | Minimum block and inline size of the remove buttons. |
--ghost-border-primary | Dropzone border while dragging. |
--ghost-border-danger | Dropzone and trigger border when invalid. |
--ghost-surface-subtle-bg | Idle dropzone background. |
--ghost-focus-ring-color | Focus ring on the trigger and remove buttons. |
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.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Examples
file-upload/asset-submission
Add files, see rejections in the field error, recover, and check what the form submits.
file-upload/themed
Default theme dropzone, trigger, and removable file list with invalid and disabled states.