0.19.0 • Published 1 month ago

@bolttech/atoms-input-number v0.19.0

Weekly downloads
-
License
-
Repository
-
Last release
1 month ago

InputNumber Component

A customizable input number component with increment and decrement buttons, label, error message support, and value formatting options.

Installation

Use the package manager npm or yarn to install the component and its dependencies.

npm install @bolttech/frontend-foundations @bolttech/atoms-input-number

or

yarn add @bolttech/frontend-foundations @bolttech/atoms-input-number

Props

The InputNumber component accepts the following properties:

PropTypeDescription
idstringThe id attribute of the input number component.
dataTestIdstringThe data-testid attribute for testing.
disabledbooleanWhether the input number is disabled or not.
errorMessagestringAn error message to be displayed.
labelstringA label to describe the input number.
onChange(value: number) => voidEvent handler when the input number value changes.
placeholderstringPlaceholder text to display when the value is zero and placeholder is not provided.
requiredbooleanWhether the input number is required or not.
valuenumberThe value of the input number.
minnumberThe minimum allowed value for the input number.
maxnumberThe maximum allowed value for the input number.
stepnumberBy how much each change should change the value of the input
templatestringA template string to format the display of the value, using $value as a placeholder.
variant'grey' or 'border'The variant of the input number component (default is 'grey').
helperMessagestringAn optional string to display as a helper message for the input number.
...propsobjectAdditional props that can be passed to the HTML input element.

Usage

import React, { useState } from 'react';
import { InputNumber } from '@bolttech/atoms-input-number';
import { bolttechTheme, BolttechThemeProvider } from '@bolttech/frontend-foundations';

const ExampleComponent = () => {
  const [inputValue, setInputValue] = useState(5);

  const handleInputChange = (newValue) => {
    setInputValue(newValue);
  };

  return (
    <BolttechThemeProvider theme={bolttechTheme}>
      <InputNumber id="input-number-id" dataTestId="custom-input-number" label="Quantity" value={inputValue} min={1} max={10} onChange={handleInputChange} placeholder="Enter quantity" variant="border" />
    </BolttechThemeProvider>
  );
};

export default ExampleComponent;

Contributing

Contributions are welcome! For any bug fixes, improvements, or new features, please open an issue or submit a pull request.

Please make sure to follow the code standards and test your changes before submitting.

0.19.0

1 month ago

0.18.0

2 months ago

0.17.1

4 months ago

0.0.1

4 months ago

0.12.0

9 months ago

0.13.0

9 months ago

0.14.0

8 months ago

0.15.0

7 months ago

0.16.0

6 months ago

0.17.0

6 months ago

0.16.1

6 months ago

0.10.0

9 months ago

0.9.0

10 months ago

0.8.0

10 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.7.0

10 months ago

0.6.0

10 months ago

0.3.5

11 months ago

0.3.2

11 months ago

0.3.4

11 months ago

0.3.3

11 months ago

0.3.0

11 months ago

0.3.1

11 months ago

0.2.5

11 months ago

0.2.4

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago