Number Input
Numeric input with increment/decrement buttons, min/max constraints, and step size. Provides a better UX than native number inputs with consistent cross-browser styling. Supports prefix/suffix text, multiple sizes, error states, and hold-to-repeat on buttons.
Preview & Code
_number_input.html.erb
███
██████ █████ █████████ █████████
█████ ████████
███ ██████ ██████████████████████████ █████ ███████████ ██████ ███████████ ██████ ██ ████ ██ ████ ███ ██
█████ █████ ███████████████
███ ██████ ██████████████████████████ █████ ████████ ██████ ████████ ███████ ████ ██████ █████ █████ ████ ██
███ ██████ ██████████████████████████ █████ █████████ ██████ █████████ ███████ █████ ██████ ██ ██
number_input_controller.js
██████ █ ██████████ █ ████ ████████████████████
██ ████████ ██ ██████████████████████████████
██████ ███████ █████ ███████ ██████████ █
██████ ███████ █ █████████ ████████████ ████████████
██████ ██████ █ █
████ █ █████ ███████ ████████ █████████ ██
████ █ █████ ███████ ████████ ████████ ██
█████ █ █████ ███████ ████████ █ █
█
number_input_component.rb
█ ██████████████████████ ████
█████ ████████████████████ █ ███████████████████
█████ █ █
███ █ ██████ ████ █████████ ███████ ████ █████ ██████ ██████████ █████ █████████ ██
███ █ ██████ █████ █████████ ███████ █████ ██████ ██████ ██████████ █████ █████████ ██
███ █ ██████ █████ ███████████ ███████ █████ ██████ ██████ ████████████ █████ █████████ █
████████
███████████ ███████ █████ █████ ██████ ███████ ██████ ██████ ████████ ████████
number_input_component.html.erb
████ ██████████ ███████████████ ███ ███ ████████████████████████████████████████ ███
██ ██ ███████████████ ██
██████ ██ ██ ██████████████ ██████████ █████ █████ ███ ██ ██████████ █████████████ ████
███ ██████ ██
████████
██ ███ ██
████ ██████████ █████████████████████ ████
███ █████████ ██████ ██
███████
number_input_controller.js
██████ █ ██████████ █ ████ ████████████████████
██ ████████ ██ ██████████████████████████████
██████ ███████ █████ ███████ ██████████ █
██████ ███████ █ █████████ ████████████ ████████████
██████ ██████ █ █
████ █ █████ ███████ ████████ █████████ ██
████ █ █████ ███████ ████████ ████████ ██
█████ █ █████ ███████ ████████ █ █
█
Changelog
- v1.0.0: Initial release with increment/decrement buttons, min/max/step support
- Hold-to-repeat on increment/decrement buttons (400ms delay, 75ms repeat)
- Keyboard arrow-key support (ArrowUp/ArrowDown)
- Prefix/suffix text, multiple sizes, error states, and disabled state
- Full dark mode support
Get Full Access
Unlock the source code for this component and all others. One-time payment for lifetime access.
Get Access Now