1.0.8 • Published 3 years ago
carelynx-attachments-uploader v1.0.8
carelynx-attachments-uploader
Allows the user to upload attachments
Install
npm install --save carelynx-attachments-uploader
Usage
import React, { Component } from 'react';
import AttachmentComponent from 'carelynx-attachments-uploader';
const App = () => {
return <AttachmentComponent />;
};
Props
Special props:
prop | type | description | required |
---|---|---|---|
onSubmitAttachment | func | Callback when a valid Attachment is uploaded by the user. The component returns the uploaded file as an object. | true |
onUpdateAttachment | func | Callback when an Attachment is updated by the user. The component returns the updated file as an object. | true |
onArchiveAttachment | func | Callback when an Attachment is archived by the user. The component returns the archived file as an object. | true |
attachments | array | An array of uploaded attachments that will be displayed in the Attachments table of the Component. | true |
show | boolean | By default the attachment component will be collapsed. If you want the default as expanded, the show prop value should be sent as true | optional |
Example for attachment object
{
base64_encoded_file: "base64 string",
description: "Attachment description entered by the user",
filename: "sample.pdf",
type: "application/pdf"
}
Prop examples
attachments
{
base64_encoded_file: {base64 string},
description: "Attachment description entered by the user",
filename: "sample.pdf",
type: "application/pdf",
url: {image url}
}
NOTE: The object needs to have either `base64_encoded_file` or the `url` property for the attachment to be displayed in the Attachment table
License
MIT © Carelynx Developers