npm.io
0.2.5 • Published 3 years ago

abdulimageuploader2

Licence
Version
0.2.5
Deps
2
Size
10 kB
Vulns
0
Weekly
0

How to configure

import { useState } from 'react';

import { ImageUploader } from 'abdulimageuploader2';

function App() {

const [file,setFile]=useState(null);

const handleSubmit=async(e)=>{ console.log(file) }

return (

<div className='container d-flex justify-content-center mt-5 ' >
  <div className=' border border-dark pb-5 px-3'>
    <h4 className='text-center '>Image Uploader</h4>
    <form onSubmit={handleSubmit} >

      <ImageUploader value={setFile}/>
      
      <button type='submit' className='btn btn-info mt-1 '>Submit</button>

    </form>
  </div>

</div>

); }

export default App;

Props :

  • value : it must be a useState setfunction and it should be provided as props, to get the file uploaded from the component.
  • updateColor : used to configure the color of update button (default is green)
  • deleteColor : used to configure the color of delete button (default is red)
  • buttonColor : used to configure the background color of button in the modal (default is gray)
  • buttonTextColor: used to configure the color of the button text in the modal (default is white)

Keywords