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
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- filerequisFile—
- The native File object to display. Provides name and size.
- indexrequisnumber—
- 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
Emplacements de contenu exposés par ce composant.
- #default
- Replaces the entire card content (icon + name + meta + progress + remove button) with custom markup.
API
Emits
Événements émis par ce composant.
- @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
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <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.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- 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
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Interactions clavier
| Touche | 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.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- 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.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Standalone drag-n-drop item