Documentation
Form Components
Number Input

NumberInput

The NumberInput component is designed for precise and efficient numeric input. It features a clean and intuitive interface, allowing users to enter numbers directly or adjust values using increment and decrement buttons.

Installation

Install the package

npm i @start-base/react-form-elements

Add the styles

To use the React form elements styles in a Next.js project, import the styles in your layout.tsx file.

app/layout.tsx
import "@start-base/react-form-elements/styles.css";

Import the component

import NumberInput from '@start-base/react-form-elements/NumberInput';

Usages

Number Input With Label

Number Input With Placeholder

Number Input With Placeholder And Label

Number Input With Placeholder And Label And Disable Shrink

Number Input Disabled

Number Input Error

Error Message

API

A numeric input component with options for prepending and appending elements.

NameTypeDefaultDescription
namestringName of the input
labelstringnullLabel of the input
placeholderstringnullPlaceholder of the input
disableShrinkbooleanfalsePosition the label outside of the input
valuestring or numberValue of the input
onChangefunctionCallback function that is fired when the value changes.
inputClassNamestringnullClassname for input element
labelClassNamestringnullClassname for label element
errorClassNamestringnullClassname for error element
disabledbooleanfalseDisable the input
errorstring or boolean or objectnullError message to display below the input. if value is a boolean input border will be change. Also you can pass schema validator error objects.
prependstring or elementnullPrepend text to the input
appendClassNamestringnullClassname for append element
prependClassNamestringnullClassname for prepend element

Styling