The number type has a step value controlling which numbers precision which defaults to 1.

You can use this to set the floating point precision

<input type="number" step="0.1">

You will have

class MyComponent extends React.Component {
  render () {
    return (
      <td>
        <label> Value: </label>
            <input
                type='number'
                step="0.1"
                min='0'
                max='20'
                className='form-control'
                value={this.state.value}
                onChange= {(evt) => this.onValueChange('value', evt.target.value)}
              />
      </td>
    )
  }
}
Answer from Shubham Khatri on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › how-to-set-input-box-to-be-a-floating-number-in-reactjs
How to set input box to be a floating number in ReactJS ? | GeeksforGeeks
November 6, 2023 - ... If we want to set the input box to be a floating number then we can use the step attribute of the input tag. We have to set the input type as the number and step value by which we want to increase/decrease the floating number.
Discussions

How to define input to keep float number in reactjs - Stack Overflow
My requirements: input must keep float number, letters and other characters are disallowed in state it should be kept as number, not string, because of many calculation are done on it I would lik... More on stackoverflow.com
🌐 stackoverflow.com
reactjs - React input type=“number” for floats - HTML standard? - Stack Overflow
Having a sample React component for testing input type behavior. Initially the input type is set to 'text' and it's value is initialized with '1.0'. Clicking the button the value will be converted... More on stackoverflow.com
🌐 stackoverflow.com
javascript - Need React input box to be a floating number
I need a simple input box to be a floating point number (anything with a . really). As it is right now, it doesn't allow me to put the dot and do a floating point. Should be simple but I can't find... More on stackoverflow.com
🌐 stackoverflow.com
React Component and Invalid Input - javascript
var App = React.createClass({ ... return ; } }); React.render(, document.body); You can see it here: http://jsfiddle.net/2hauj2qg/ The problem is that if I want to type in a number like: "4.7". When the user enters, "4.", it becomes "4", due to being converted to a float in ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Erikmartinjordan
erikmartinjordan.com › input-float-numbers-react
Create an input allowing only float numbers in React — Erik Martín Jordán
import React, { useState } from 'react' const floatInput = () => { const [number, setNumber] = useState('') const handleNumber = (e) => { let input = e.target.value if(input.match(/^([0-9]{1,})?(\.)?([0-9]{1,})?$/)) setNumber(input) } const handleFloat = () => { // The conditional prevents parseFloat(null) = NaN (when the user deletes the input) setNumber(parseFloat(number) || '') } return <input placeholder = 'Type number...' value = {number} onChange = {handleNumber} onBlur = {handleFloat}/> }
🌐
npm
npmjs.com › package › react-floating-label-input
react-floating-label-input - npm
October 1, 2021 - import React from 'react'; import FloatingLabelInput from 'react-floating-label-input'; export default ({ onChange, value }) => <div style={{ fontSize: 64 }}> <FloatingLabelInput id="example-3" label="label" onBlur={action('onBlur')} onChange={action('onChange')} onFocus={action('onFocus')} value={value} /> </div>;
      » npm install react-floating-label-input
    
Published: Oct 01, 2021
Version: 4.3.4
Author: Cymen Vig
🌐
GitHub
github.com › pamoller › react-fixed-float-input
GitHub - pamoller/react-fixed-float-input · GitHub
Format the content of a <input/> element as a float with fixed precision. Additional digits will be rounded on initialization and on the blur event. ... import { useState } from 'react'; import FixedFloatInput from 'react-fixed-float-input'; ...
Author: pamoller
🌐
Stack Overflow
stackoverflow.com › questions › 59369589 › how-to-define-input-to-keep-float-number-in-reactjs
How to define input to keep float number in reactjs - Stack Overflow
input must keep float number, letters and other characters are disallowed · in state it should be kept as number, not string, because of many calculation are done on it · I would like to prevent leading zeroes to be shown in input e.g. 000123.45 ...
🌐
Stack Overflow
stackoverflow.com › questions › 62208938 › react-input-type-number-for-floats-html-standard
reactjs - React input type=“number” for floats - HTML standard? - Stack Overflow
The value of <input type="number"> is specified as valid floating-point number (html.spec.whatwg.org/multipage/…), which supports not only fractional part but also exponential form like 1.9E2 ·
Find elsewhere
🌐
Medium
medium.com › @Franklivania › creating-form-with-floating-label-react-js-sass-937c9bfbe3c8
Creating Form with floating label React.js + SASS | by Chibuzo Franklin Odigbo | Medium
July 15, 2023 - Before this, I had tried multiple forms to be able to get a functional react form input with a label that floats and stays in place when there is value in the input tag. So, I will be providing you with schematics and a detailed view of how I did this and got my own result, which I believe is the radical way to solve this. So, for basics, I would start by properly creating a react app using Vite. The reason for vite is that it is a faster and more reliable way of prompting your react project in any format (including typescript), with fewer bugs and unnecessary dependencies.
🌐
npm
npmjs.com › package › react-numeric-input
react-numeric-input - npm
In this react component this becomes even more desirable as the display value might be formatted and have nothing in common with the underlying value meaning that one might need to call parse to find out what the numeric value is. For that reason this component exposes getValueAsNumber() method on the input element. Also keep in mind that this really returns a number (float) so it might be different from the displayed value.
      » npm install react-numeric-input
    
Published: Jan 13, 2018
Version: 2.2.3
🌐
Medium
medium.com › @junaama › creating-a-floating-label-input-in-react-using-functional-components-2777aa193dfd
Creating a Floating Label Input in React using Functional Components | by Naama | Medium
July 3, 2020 - First up we need to set padding on the float-wrapper div to provide space between the label and input text when the label transitions.
🌐
CoreUI
coreui.io › react › documentation › forms › floating labels
React Floating labels - CoreUI
March 3, 2026 - You can create the same form control by wrapping a pair of <CFormInput> and <CFormLabel> elements in <CFormFloating> to enable floating labels with textual form fields. A placeholder is required on each <CFormInput> as our method of CSS-only ...
🌐
Swiftcarrot
swiftcarrot.dev › react-input-number
react-input-number
<InputNumber enableMobileNumericKeyboard /> will open a numeric keyboard on ios and android devices. Notice that on ios the keyboard doesnot contain the .(dot) character for floating numbers. 2.2(number) function App() { const [num, setNum] = React.useState(2.2); return ( <> <div> {num}({typeof num}) </div> <InputNumber ·
🌐
DEV Community
dev.to › morewings › lets-create-a-better-number-input-with-react-1j0m
Let's create a better Number Input with React and Tailwind CSS - DEV Community
March 5, 2025 - <input type="text" pattern="(?:0|[1-9]\d*)" inputMode="decimal" autoComplete="off"/> inputMode="decimal" sets proper keyboard for touch devices. autoComplete="off" is needed to disable annoying browser autocomplete, usually such functionality is needed for name-like inputs. // List of available numeric modes enum Modes { natural = 'natural', integer = 'integer', floating = 'floating', scientific = 'scientific', } type Value = string; export type Props = { /** Set controlled value */ value?: Value; /** Provide a callback to capture changes */ onChange?: (value?: Value) => void; /** * Define a n
🌐
Marmelab
marmelab.com › react-admin › NumberInput.html
React-admin - The NumberInput Component
import { Edit, SimpleForm, TextInput, NumberInput, required } from 'react-admin'; export const PostEdit = () => ( <Edit> <SimpleForm> <TextInput source="title" /> <NumberInput source="average_note" validate={[required()]} /> </SimpleForm> </Edit> ); <NumberInput> works for integer and float values.
🌐
Reddit
reddit.com › r/reactjs › good headless input library for currency and float, decimal numbers?
r/reactjs on Reddit: Good Headless Input library for currency and float, decimal numbers?
September 5, 2022 -

Hi guys, I'm looking for a react library that handles number inputs (with decimals-thousands separators and currency support).

I tried https://github.com/cchanxzy/react-currency-input-field but it could not connect properly with the form.

Bonus: To work well with react hook form.

🌐
DEV Community
dev.to › rafacdomin › creating-floating-label-placeholder-for-input-with-reactjs-4m1f
Creating Floating Label/Placeholder for Input with ReactJS - DEV Community
August 19, 2020 - Now we add position absolute to our label and a transform to center our label, as if it were a placeholder for our input: #float-label label { ...
🌐
Stack Overflow
stackoverflow.com › questions › 59996583 › react-input-type-number-for-floats
reactjs - React input type="number" for floats - Stack Overflow
January 31, 2020 - I think the number input type can handle the German comma system. So there might not be a need to manually change a 2,5 input into a 2.5. If you use this changeHandler on a number input · Copyconst changeHandler = e => { const val = e.target.value console.log(2 * val) setNumber(val) } the val variable will be a usual float while you see a comma in the input.