A simple, customizable quantity input component for React that allows users to increment/decrement numeric values.
npm install react-quantity-inputA simple, customizable quantity input component for React that allows users to increment/decrement numeric values.
- Supports increment/decrement actions
- Fully customizable
- Works with both numbers and strings
- Built-in TypeScript support
``bash`
npm install react-quantity-input
or
yarn install react-quantity-input
- react >= 18.3.1react-dom >= 18.3.1
-
`jsx
import React, { useState } from 'react';
import ReactQuantityInput from 'react-quantity-input';
const MyComponent = () => {
const [quantity, setQuantity] = useState(1);
const handleQuantityChange = (newQuantity) => {
setQuantity(newQuantity);
};
return (
export default MyComponent;
`
- Value
- min? - Minimum allowed value
- max? - Maximum allowed value
- step? - Increment/decrement step value
- placeholder? - Placeholder text for the input
- maxLength? - Max number of characters in the input
- disabled? - Disable the input field
- isInvalid? - Indicates if the input is in an invalid state
- onState?` - Callback when input is active or clicked