All Projects → sidevesh → react-file-input-previews-base64

sidevesh / react-file-input-previews-base64

Licence: other
This package provides an easy to use, ready to go and customizable wrapper around file input, with option for image previews and returning file as base64 string.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-file-input-previews-base64

file-upload-with-preview
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.
Stars: ✭ 406 (+2606.67%)
Mutual labels:  input, upload, file, preview
File Upload With Preview
🖼 A simple file-upload utility that shows a preview of the uploaded image. Written in pure JavaScript. No dependencies. Works well with Bootstrap 4 or without a framework.
Stars: ✭ 352 (+2246.67%)
Mutual labels:  input, upload, file, preview
PHP-FileUpload
Simple and convenient file uploads — secure by default
Stars: ✭ 53 (+253.33%)
Mutual labels:  input, upload, file, form
Ngx Material File Input
File input for Angular Material form-field
Stars: ✭ 193 (+1186.67%)
Mutual labels:  input, upload, file
react-simple-file-input
Simple wrapper for the HTML input tag and HTML5 FileReader API
Stars: ✭ 29 (+93.33%)
Mutual labels:  input, upload, file
file-input-accessor
Angular directive that provides file input functionality in Angular forms.
Stars: ✭ 32 (+113.33%)
Mutual labels:  input, file, form
ngx-dropzone
A highly configurable dropzone component for Angular.
Stars: ✭ 123 (+720%)
Mutual labels:  upload, file, preview
Vue Formulate
⚡️ The easiest way to build forms with Vue.
Stars: ✭ 1,947 (+12880%)
Mutual labels:  input, form
Ant Plus
🔺 Ant Design 表单简化版
Stars: ✭ 212 (+1313.33%)
Mutual labels:  input, form
Tiny Qiniu
A tiny qiniu sdk for uploading file.
Stars: ✭ 15 (+0%)
Mutual labels:  base64, upload
Base64 Encoder
Base64 Encoder
Stars: ✭ 245 (+1533.33%)
Mutual labels:  base64, file
WP-Media-Uploader
Easily create a custom media upload button in WordPress admin dashboard that you can use in your plugin
Stars: ✭ 25 (+66.67%)
Mutual labels:  upload, form
svelte-filepond
🔌 A handy FilePond adapter component for Svelte
Stars: ✭ 188 (+1153.33%)
Mutual labels:  upload, file
Jhform
JhForm - 自定义表单工具,更加简单,快捷的创建表单、设置页面
Stars: ✭ 108 (+620%)
Mutual labels:  input, form
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (+566.67%)
Mutual labels:  input, form
Aura.input
Tools to describe HTML form fields and values.
Stars: ✭ 60 (+300%)
Mutual labels:  input, form
Customui
Library to create custom UI's in MCPE 1.2+
Stars: ✭ 60 (+300%)
Mutual labels:  input, form
blur-up
A tool that creates preview images.
Stars: ✭ 28 (+86.67%)
Mutual labels:  base64, preview
Insert Text At Cursor
Fast crossbrowser insertion of text at cursor position in a textarea / input
Stars: ✭ 49 (+226.67%)
Mutual labels:  input, form
Awesomevalidation
Android validation library which helps developer boil down the tedious work to three easy steps.
Stars: ✭ 1,093 (+7186.67%)
Mutual labels:  input, form

react-file-input-previews-base64

This package provides an easy to use, ready to go and customizable wrapper around file input, with option for image previews and returning file as base64 string.

demo

Installation

npm install --save react-file-input-previews-base64

Basic Usage

import FileInputComponent from 'react-file-input-previews-base64'

Example Code

<FileInputComponent
  labelText="Select file"
  labelStyle={{fontSize:14}}
  multiple={true}
  callbackFunction={(file_arr)=>{console.log(file_arr)}}
  accept="image/*" 
/>

Options

Prop Type Effect Default Value
labelText string The text to show in label "File Upload"
multiple boolean Whether multiple files can be selected or not true
accept string string which is passed to accept field of input tag, to specify the types of files that can be selected "*"
imagePreview boolean Whether preview section is shown or not true
textBoxVisible boolean Whether a controlled text field showing information be shown false
useTapEventPlugin boolean Whether to use onTouchTap or onClick false
callbackFunction function The function to be called when files are processed, can take either array of file describing objects or single object depending on if multiple files are allowed ()=>{}
nonPreviewComponent component Component to show in preview section for non-image files, title, size and type are passed to this as props included <NonPreviewDefaultComponent />
buttonComponent component The component to show for button, onClick or onTouchTap will be merged to its props to trigger the file selector box to show internally <button type="button">Attach</button>
textFieldComponent component The component to show for controlled text field, onClick or onTouchTap will be merged to its props to trigger the file selector box to show internally, along with value prop for showing information like "foobar.jpg", "2 files selected", "No file selected" etc <input type="text" />
imageContainerStyle object Object passed to style prop of image preview section container div {display:"flex", flexDirection:"row", width:"100%", flexWrap:"wrap"}
imageStyle object Object passed to style prop of image previews {marginTop: 5, marginBottom: 5, marginRight: 5, width: "auto", height: "30vmin", boxShadow:"rgba(0, 0, 0, 0.188235) 0px 10px 30px, rgba(0, 0, 0, 0.227451) 0px 6px 10px"}
parentStyle object Object passed to style prop of container div of whole component {marginTop:14}
labelStyle object Object passed to style prop of label {fontSize: 16,color:'rgba(0, 0, 0, 0.298039)',display:'block'}
inputId string String passed to id prop of input and htmlFor tag of label components, if not present clicking on label won't trigger the file sector to show none
inputName string String passed to name prop of input, if not present, using this component as part of form will not work. none
defaultFiles array Array consisting of urls of files to show as pre-selections, useful for edit forms, currently only supports urls to image files []

Note

  • onTouchTap is implmented by react-tap-event-plugin and is used in the amazing material-ui.
  • I am using this with material-ui library and the default props for styles follows the material design pattern.
  • The structure of file describing object is:
{
  name: "IMG_20160813_102226.jpg",
  type: "image/jpeg",
  size: 645,
  base64: "data:image/jpeg;base64,/9j/4SzyRXhpZgAATU0AKgA...",
  file: File
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].