Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@bolttech/atoms-input-number

Package Overview
Dependencies
Maintainers
8
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bolttech/atoms-input-number

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

npmnpm
Version
0.0.1
Version published
Weekly downloads
319
93.33%
Maintainers
8
Weekly downloads
 
Created
Source

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.
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').
...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.

FAQs

Package last updated on 24 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts