2.2.2 • Published 1 year ago

addremove-input-fields-dynamically v2.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Add/Remove Input Fields Dynamically

The \"addremove-input-fields-dynamically\" npm package provides a simple and efficient solution for dynamically adding and removing input fields in web applications.Developers can integrate this package into their projects to enable users to add new input fields dynamically with a click of a button, as well as remove existing input fields as needed.

Demo

DEMO

Installation

Install my-project with npm

npm i addremove-input-fields-dynamically

Usage/Examples DynamicInput

import { DynamicInput } from "addremove-input-fields-dynamically";
import { useState } from "react";
import "addremove-input-fields-dynamically/dist/index.css";
import cancelIconSvg from "addremove-input-fields-dynamically/dist/icons/cancel.svg";
import addIconSvg from "addremove-input-fields-dynamically/dist/icons/add.svg";

function App() {
  const [inputOptions, setInputOptions] = useState([]);
  return (
    <DynamicInput
      inputOptions={inputOptions}
      setInputOptions={setInputOptions}
      cancelIcon={cancelIconSvg}
      buttonIconBefore={addIconSvg}
    />
  );
}

export default App;

Usage/Examples DynamicDoubleInput

import { DynamicDoubleInput } from "addremove-input-fields-dynamically";
import { useState } from "react";
import "addremove-input-fields-dynamically/dist/index.css";
import cancelIconSvg from "addremove-input-fields-dynamically/dist/icons/cancel.svg";
import addIconSvg from "addremove-input-fields-dynamically/dist/icons/add.svg";

function App() {
  const [inputOptions, setInputOptions] = useState([
    { id: 1, value1: "", value2: "" },
  ]);
  return (
    <DynamicDoubleInput
      inputOptions={inputOptions}
      setInputOptions={setInputOptions}
      cancelIcon={cancelIconSvg}
      buttonIconBefore={addIconSvg}
    />
  );
}

export default App;

Package Customization

Property nameTypeDefaultDescription
inputOptionsvariableinputOptionspass useState variable
setInputOptionsfunctionsetInputOptionspass useState state update function
inputAttributesobjectempty objectinput attributes with key pair value. example {readonly:"readonly"}
inputAttributesTwoobjectempty object(for input two) input attributes with key pair value. example {readonly:"readonly"}
buttonAttributesobjectempty objectinput attributes with key pair value. example {diabaled:"disabled"}
lengthnumber0how many options can added
containerClassNamestringnulladd your own css
itemClassNamestringnulladd your own css
inputClassNamestringnulladd your own css
cancelClassNamestringnulladd your own css
buttonClassNamestringnulladd your own css
buttonErrorClassNamestringnulladd your own css
buttonTextstringaddadd your own button text
cancelIconimage filesvgadd your own icon
buttonIconBeforeimage filesvgadd your own icon
buttonIconAfterimage filesvgadd your own icon

Hi, I'm Rayan Hossain! 👋

🚀 About Me

Passionate MERN Stack Developer || Building Innovative Web Solutions with MongoDB || Express JS || React JS || Next JS || Node.js || Mentor

🔗 Links

github linkedin

License

This software is free to use under the MIT license. See the LICENSE file for license text and copyright information.

2.1.1

1 year ago

2.2.2

1 year ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.0.0

1 year ago