FileFieldDragNDropItem
File card rendered inside a drag-and-drop dropzone. Displays the file icon, name, human-readable size, an optional progress bar, and a remove button.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-file-field-dragndrop-item> — 5 internal parts. The root ① is a horizontal flex row; the icon ② is a static file glyph; the content ③ stacks the name, meta text and optional progress bar ④; the actions zone ⑤ holds the remove button.- 1.origam-file-field-dragndrop-item
- Root element. display: flex; align-items: center; gap driven by --origam-file-field-dragndrop-item---gap (default 12px).
- 2.origam-file-field-dragndrop-item__icon
- OrigamIcon rendered from the fileIcon prop. flex-shrink: 0; color from --origam-file-field-dragndrop-item__icon---color.
- 3.origam-file-field-dragndrop-item__content
- Flex column: stacks __name, __meta and optional __progress. flex-grow: 1; min-width: 0 (truncation support).
- 4.origam-file-field-dragndrop-item__progress
- OrigamProgress bar. Rendered only when the progress prop is a number. height: 4px; rounded.
- 5.origam-file-field-dragndrop-item__actions
- Flex row of action buttons. flex-shrink: 0. Contains the remove OrigamBtn (flat, size="small").
API
Props
All props accepted by this component, with their type, default value and description.
- filerequiredFile—
- The native File object to display. Provides name and size.
- indexrequirednumber—
- Zero-based index of the file in the current selection. Passed back in the click:remove emit payload.
- progressnumber
- Upload progress from 0 to 100. When defined, an OrigamProgress bar is rendered below the file meta.
- fileIconstringMDI_ICONS.FILE
- MDI icon name for the file type indicator. Defaults to the generic file icon.
- removeIconstringMDI_ICONS.CLOSE
- MDI icon for the remove button. Defaults to mdi-close.
- downloadIconstring
- downloadableboolean
- disabledbooleanfalse
- Disables the remove button.
- readonlybooleanfalse
- Makes the remove button non-interactive without altering its visual state.
- showSizeboolean | 1000 | 1024
- Controls the SI base for the human-readable file size display. true uses the default base; 1000 = SI (kB), 1024 = IEC (KiB).
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- color
- Intent or custom color applied to the progress bar.
- fontSizeTFontSize
- fontWeightTFontWeight
API
Slots
Content slots exposed by this component.
- #default
- Replaces the entire card content (icon + name + meta + progress + remove button) with custom markup.
API
Emits
Events emitted by this component.
- @click:remove{ file: File, index: number }
- Fired when the user clicks the remove button. Payload carries the File reference and its index so the parent can splice the selection array.
- @click:download{ file: File, index: number }
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to child components.
- Ref<string>
- Reactive CSS string generated by useStyle from the computed root styles.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document.
- () => void
- Removes the injected style sheet.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Gap between the icon, content column and actions zone.
- Gap between name, meta and progress bar inside the content column.
- Gap between action buttons (when multiple are rendered).
- Color of the file type icon glyph.
- Font size for the file name label.
- Font weight for the file name label.
- Color of the file size / meta text.
- Font size for the file size / meta text.
- Top margin of the progress bar inside the content column.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
Keyboard interactions
| Key | Action |
|---|---|
| Enter / Space | Activates the remove button when focused — native <button> behaviour. |
| Tab | Moves focus to the remove button and then to the next interactive element. |
Notes
- The remove button is a native <button> (via OrigamBtn). It is disabled when disabled=true or readonly=true — pointer events and keyboard activation are suppressed.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- dimensionvar(--origam-space---3)
- Gap between icon, content column and actions (12px).
- colorvar(--origam-color__text---secondary)
- File type icon foreground color.
- dimensionvar(--origam-font__size---md)
- File name font size (0.875rem).
- colorvar(--origam-color__text---secondary)
- File size / meta text color.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Standalone drag-n-drop item