LibraryAttachments
LibraryAttachments manages a list item's attachments by storing them in a document library (rather than as classic list attachments), linked back to the item through a lookup field. This gives you versioning, metadata, and large-file support that classic attachments lack.
SPFx component
Imported from @spartanfx/react/spfx; reads and writes a SharePoint document library.
When to use
- Attach files to list items but keep them in a proper document library (versioning, permissions, metadata).
- Scope attachments to a section of a form via a section field.
Import
import { LibraryAttachments } from '@spartanfx/react';
Basic usage
Point it at the libraryName and the lookupFieldName that links attachments to the parent item.
<LibraryAttachments
libraryName="Project Attachments"
lookupFieldName="ProjectRef"
accept=".pdf,.docx,.png"
allowMultiple
/>
Scope to a section
<LibraryAttachments
libraryName="Project Attachments"
lookupFieldName="ProjectRef"
section="Contracts"
sectionFieldName="AttachmentSection"
/>
Key props
| Prop | Type | Default | Notes |
|---|---|---|---|
libraryName (required) | string | — | Target document library. |
lookupFieldName (required) | string | — | Lookup field linking attachments to the item. |
accept | string | — | Acceptable file types (e.g. .pdf,.docx). |
allowMultiple | boolean | true | Allow multiple attachments. |
disabled | boolean | — | Disable upload/delete. |
section / sectionFieldName | string | — | Scope attachments to a section. |
See the full generated reference: LibraryAttachments API ↗.