1.1.1 • Published 5 months ago
react-input-fields v1.1.1
react-input-fields
A React package for easily handling file input fields, supporting various file types such as images, videos, and other files. It allows users to upload files via drag-and-drop or the standard file input interface.
Features
Feature | Description |
---|---|
Drag-and-Drop Upload | Supports drag-and-drop file upload. |
Multiple File Types Supported | Accepts images, videos, and other file types. |
Minimal Setup | Easy-to-use with React and minimal setup. |
Installation
You can install the react-input-fields
package via npm:
npm install react-input-fields
How to Use
Basic Usage of ImageInput Component
The package provides an easy-to-use ImageInput component that allows users to upload images through drag-and-drop or standard file input.
## Example
Here’s how to use the `ImageInput` component in your React project:
| Input Type | Component | Props |
|-------------------------|-----------------------|--------------------------------------------------------------------------------|
| Image | `<ImageInput />` | `{ width = "100%", height = "auto", inputName = "image", color = "#FFA500", background = "#808080" }` |
Import the Component: Import the ImageInput component from react-input-fields into your React component.
Render the Input: Use the ImageInput component in your JSX to allow users to upload their images.
Component Props
Prop Type Description Default Value
onChange function Callback function when a file is selected. null
color string The color of the border and text during drag. "#FF6347"
background string The background color of the input field. "#f0f0f0"
width string The width of the input field. "100%"
height string The height of the input field. "auto"