Socket
Socket
Sign inDemoInstall

filestack-react

Package Overview
Dependencies
49
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    filestack-react

Official React component for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.


Version published
Weekly downloads
23K
increased by10.63%
Maintainers
4
Created
Weekly downloads
 

Changelog

Source

5.0.0 (2023-12-12)

  • Dependency Upgraded packages to the latest possible version while maintaining backward compatibility.

Readme

Source

filestack-react

React component which allow you to easily integrate powerful filestack-api into your app.



Table of Contents

Overview

filestack-react is a wrapper on filestack-js sdk which allow you to integrate with Filestack service in just a few lines of code. Almost all you can do with filestack-js you can do with this component.

Usage

Install it through NPM

npm install filestack-react

then just insert into your app

import { PickerOverlay } from 'filestack-react';

<PickerOverlay
  apikey={YOUR_API_KEY}
  onSuccess={(res) => console.log(res)}
  onUploadDone={(res) => console.log(res)}
/>

Props

KeyTypeRequiredDefaultDescription
apikeyStringtrueFilestack api key
clientOptionsObjectfalsehttps://filestack.github.io/filestack-js/interfaces/clientoptions.html
pickerOptionsObjectfalsehttps://filestack.github.io/filestack-js/interfaces/pickeroptions.html
@deprecated onSuccessFunctionfalseresult => console.log(result)A function to be called after successful completed action
onUploadDoneFunctionfalseresult => console.log(result)Called when all files have been uploaded
onErrorFunctionfalseerror => console.error(error)A function to be called when error occurs
onErrorFunctionfalseerror => console.error(error)A function to be called when error occurs

Examples

Render basic Overlay Picker

<PickerOverlay apikey='YOUR_APIKEY'/>

Render basic Inline Picker

<PickerInline apikey='YOUR_APIKEY'/>

Render basic Drop Pane Picker

<PickerDropPane apikey='YOUR_APIKEY'/>

Show picker directly and embed it inside specific container

<PickerInline apikey='YOUR_APIKEY'><div className="your-container"></div></PickerInline>

filestack-js Client

If you need to use Client just try

import { client } from 'filestack-react';

SSR

If you need to use filestack-react with SSR project or site generators like Gatsby check some workarounds in this issues
issue57
issue65

Migration from 3.x.x and 4.x.x

3.x.x4.0.0Comment
apikeyapikey
actionOptionspickerOptionsWe want to be consistent with other filestack libs
clientOptionsclientOptions
onSuccessonSuccess
onErroronError
N/AchildrenChildren prop will be used now in case you'll want to use specific container
actionN/ADefault picker action will be 'pick' always
fileN/ARemoved
sourceN/ARemoved
customRenderN/ARemoved, from now on clients will be responsible for rendering
componentDisplayModeN/ARemoved, from now on clients will be responsible for rendering

Migration from 1.x.x and 2.x.x

One of the changes introduced in the new version are rethinked props that the component accepts, so that the use of the component is as straightforward as possible. Below you will find information about what happened to each of the options available in 2.x.x :

2.x.x3.0.0Comment
apikeyapikey
modeaction
optionsactionOptionsWe want to emphasize that this option is associated with 'action'
preloadN/ANow, component is at default preloading necessary js assets, styles, images
filefile
onSuccessonSuccess
onErroronError
options.handlesourceHandle or url used by specific action is now stored in separate prop
options.urlsourceHandle or url used by specific action is now stored in separate prop
securityclientOptions.securityOptions used to initialize filestack client are now grouped in ‘clientOptions’
buttonTextcomponentDisplayMode.customTextUse componentDisplayMode option (see examples)
buttonClasscomponentDisplayMode.customClassUse componentDisplayMode option (see examples)
cnameclientOptions.cnameOptions used to initialize filestack client are now grouped in ‘clientOptions’
sessionCacheclientOptions.sessionCacheOptions used to initialize filestack client are now grouped in ‘clientOptions’
rendercustomRender
childrenN/AUse customRender instead

Live demo

Check demo at codepen https://codepen.io/Filestack/pen/KEpVdR - needs to be updated for 4.0 version

Development

All components are located inside src/picker/

After you add some changes just type

npm run build

Be sure that your change doesn't break existing tests and are compatible with linter

npm run test

Documentation

You can find info about available options for actions (Client class methods) in https://filestack.github.io/filestack-js/

Contribution

Any your contributions or ideas are more than welcome. Please consider that we follow the conventional commits specification to ensure consistent commit messages and changelog formatting.

Future

Current ideas:

  • Better support for SSR, static site generator and isomorphic apps

Keywords

FAQs

Last updated on 12 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc