Skip to content

ListItemAttachments control

This control allows you to manage list item attachments, you can add or delete associated attachments. The attachments are listed in tile view.

Here is an example of the control:

ListItemAttachments Upload

ListItemAttachments Tiles

ListItemAttachments Confirm Delete

ListItemAttachments Attachment Deleted

How to use this control in your solutions

  • Check that you installed the @pnp/spfx-controls-react dependency. Check out the getting started page for more information about installing the dependency.
  • Import the control into your component:
import { ListItemAttachments } from '@pnp/spfx-controls-react/lib/ListItemAttachments';
  • Use the ListItemAttachments control in your code as follows:
<ListItemAttachments listId='dfa283f4-5faf-4d54-b6b8-5bcaf2725af5'
                     disabled={false} />


The ListItemAttachments control can be configured with the following properties:

Property Type Required Description
context WebPartContext | ExtensionContext yes SPFx web part or extention context
itemId number yes List Item Id
listId string yes Guid of the list.
webUrl string no URL of the site. By default it uses the current site URL.
disabled boolean no Specifies if the control is disabled or not.
openAttachmentsInNewWindow boolean no Specifies if the attachment should be openend in a separate browser tab. Use this property set to true if you plan to use the component in Microsoft Teams.