Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
react-input-numeric
Advanced tools
Better number input for React
→ Demo
Install the package using NPM:
npm install react-input-numeric
Add the component to your React application:
import InputNumeric from 'react-input-numeric';
// Somewhere in your code:
<InputNumeric
value={this.state.value}
onChange={value => this.setState({ value })}
/>
import React, { Component } from 'react';
import InputNumeric from 'react-input-numeric';
export default class ExampleComponent extends Component {
constructor() {
super();
this.state = {
value: 0
};
}
render() {
return (
<InputNumeric
value={this.state.value}
onChange={value => this.setState({ value })}
/>
);
}
}
Prop | Type | Default | Description |
---|---|---|---|
value (required) | Number | – | Value currently displayed in the input field |
max | Number | – | Maximal value |
min | Number | – | Minimal value |
decimals | Number (integer) | 2 | Number of digits after the decimal point |
step | Number | 1 | Difference between the possible values (e.g. 1 only allows integers) |
name | String | – | HTML name attribute to be assigned to the input field |
disabled | Boolean | false | Input should not be editable and buttons not clickable |
showButtons | Boolean | true | Show/hide buttons for incrementing/decrementing |
showTrailingZeros | Boolean | false | Display e.g. 4.00 instead of 4 (with decimals={2} ) |
snapToStep | Boolean | false | Snap manually entered values to the nearest multiple of step |
onBlur | Function | – | Function to be executed when the component loses focus (current value is passed as parameter) |
onChange | Function | – | Function to be executed when the value is changed (new value is passed as parameter) |
onFocus | Function | – | Function to be executed when the input field gets focus (current value is passed as parameter) |
decimals
prop, the exact value is always stored and passed to the onBlur
, onChange
, and onFocus
functions. Only the value displayed to the user is rounded.FAQs
Better number input for React
We found that react-input-numeric demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.