Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
rc-input-number
Advanced tools
The rc-input-number package is a React component that provides an input field specifically designed for numeric values. It allows users to input numbers either by typing them directly or by using increment and decrement buttons. This package offers features such as precision control, keyboard navigation, and customizable styles.
Basic Numeric Input
This code sample demonstrates how to create a basic numeric input field with a default value, minimum, and maximum value.
import InputNumber from 'rc-input-number';
function App() {
return (
<InputNumber
defaultValue={3}
min={1}
max={10}
/>
);
}
Precision Control
This code sample shows how to set the step and precision for the numeric input, allowing users to increment or decrement by a specific value and control the number of digits after the decimal point.
import InputNumber from 'rc-input-number';
function App() {
return (
<InputNumber
defaultValue={3.5}
step={0.1}
precision={2}
/>
);
}
Keyboard Navigation
This code sample illustrates how to handle keyboard events, enabling users to navigate and modify the input value using their keyboard.
import InputNumber from 'rc-input-number';
function App() {
return (
<InputNumber
defaultValue={3}
onKeyDown={(e) => console.log('KeyDown', e)}
/>
);
}
Custom Styles
This code sample demonstrates how to apply custom styles to the numeric input component to match the design requirements of your application.
import InputNumber from 'rc-input-number';
function App() {
return (
<InputNumber
defaultValue={3}
style={{ width: 100 }}
/>
);
}
The react-numeric-input package is another React component that provides similar functionality to rc-input-number. It allows for numeric input with increment and decrement controls. It also supports keyboard navigation and can be styled using CSS. Compared to rc-input-number, it may offer different customization options or API design.
The react-number-input package is a lightweight React component for numeric input. It includes features like formatting and validation. While it provides similar functionality, the focus on formatting and validation might make it more suitable for use cases where these features are a priority.
The input-number package is a generic HTML5 number input component that can be used with or without a framework like React. It provides a simple way to input numbers with browser-native controls. Compared to rc-input-number, it might not offer as many customization options or React-specific features.
input number ui component for react (web & react-native)
web:
react-native:
var InputNumber = require('rc-input-number');
var React = require('react');
var ReactDOM = require('react-dom');
ReactDOM.render(<InputNumber defaultValue={19}/>, container);
npm install
npm start
http://127.0.0.1:8000/examples/
online example: http://react-component.github.io/input-number/examples/
npm run rn-start
load
http://localhost:8081/examples/react-native/demo.bundle?platform=ios
in RNPlayground
name | type | default | description |
---|---|---|---|
min | Number | Specifies the minimum value | |
max | Number | Specifies the maximum value | |
step | Number or String | 1 | Specifies the legal number intervals |
disabled | Boolean | false | Specifies that an InputNumber should be disabled |
autoFocus | Boolean | false | Specifies that an InputNumber should automatically get focus when the page loads |
readOnly | Boolean | false | Specifies that an InputNumber is read only |
name | String | Specifies the name of an InputNumber(`web only`) | |
value | Number | Specifies the value of an InputNumber | |
defaultValue | Number | Specifies the defaultValue of an InputNumber | |
onChange | Function | Called when value of an InputNumber changed | |
style | Object | root style. such as {width:100} | |
styles | ReactNative StyleSheet | component's stylesheet, can use lib/styles | |
upStyle | Object | up step wrap style. `react native only` | |
downStyle | Object | down step style. `react native only` | |
inputStyle | Object | input style. `react native only` |
http://127.0.0.1:8000/tests/runner.html?coverage
rc-input-number is released under the MIT license.
2.6.0 / 2016-07-20
FAQs
React input-number component
We found that rc-input-number demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.