Display an upload button in a Lightning Web Component

This article explains how to embed the SharinPix Upload Button component in a Lightning Web Component.

Call the SharinPix Upload Button (LWC) inside Lightning Web Component

The sample code below demonstrates how to call the SharinPix Upload Button (LWC) inside the markup of a Lightning Web Component.

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>60.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__RecordPage</target>
    </targets>
</LightningComponentBundle>
Click to copy
<template>
  <sharinpix-sharinpix-upload
      album-id={recordId}
      label={label}
      component-id={componentId}
      enable-action={enableAction}
      enable-image-sync={enableImageSync}
      enable-toast={enableToast}
      permission-id={permissionId}
      auto-tags={autoTags}>
  </sharinpix-sharinpix-upload>
</template>
Click to copy
import { LightningElement, api } from 'lwc';

export default class UploadButton extends LightningElement {
    @api recordId
    label = // label
    componentId = // componentId
    enableAction = // enableAction
    enableImageSync = // enableImageSync
    enableToast = // enableToast
    permissionId = // permission Name or Id
    autoTags = // autoTags
    
    //The parameters are explained in more details below.
}
Click to copy

Note: 

  • The parameter's value can be modified as per your use-case.
  • The SharinPixPermissionName highlighted above should be replaced with the name or Id of a SharinPix Permission.

The table below details the parameters available of the SharinPix Upload Button (LWC).

Parameter
Type
Description
albumId
String
Corresponds to the Salesforce record ID (album ID) to which the photos should be uploaded. This parameter is mandatory.
label
String
Used to configure the button label.
componentId
String
Takes the user-defined component ID as value to identify this component when using multiple components.
enableAction
Boolean
Enables the Tag Action feature on the upload button.
enableImageSync
Boolean
Enables the Image Sync feature on the upload button.
enableToast
Boolean
Enables toast on successful image upload.
permissionId
String
Includes the Salesforce record ID or Name of a SharinPix Permission record which can be created to control access rights for the SharinPix Upload Button component.
autoTags
String
Used to pass one or more tags to be automatically applied on files uploaded using the SharinPix Upload Button component. If multiple auto-tags are needed, they should be delimited by a semi-colon. Example: TagA;TagB;TagC

0 Comments

Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.