Single <touchspin-input> element for all your numeric input needs
No Shadow DOM Framework-Agnostic Easy to Use
Simple numeric input with min/max constraints:
<touchspin-input
min="0"
max="100"
value="42"
step="1"
data-testid="basic-demo"
></touchspin-input>
Add labels before and after the input:
<touchspin-input
min="0"
max="1000"
value="50"
step="1"
prefix="$"
postfix=".00"
data-testid="currency-demo"
></touchspin-input>
Support for decimal numbers with precision control:
<touchspin-input
min="0"
max="10"
value="3.14"
step="0.01"
decimals="2"
data-testid="decimal-demo"
></touchspin-input>
Stack buttons vertically for a compact layout:
<touchspin-input
min="0"
max="100"
value="25"
step="5"
verticalbuttons
data-testid="vertical-demo"
></touchspin-input>
Access and control the component programmatically:
// Access the web component
const component = document.querySelector('#api-example');
const api = component.api;
// Use API methods
api.upOnce(); // Increment
api.downOnce(); // Decrement
api.getValue(); // Get current value
api.setValue(75); // Set value
// Listen to events
api.on('change', (value) => {
console.log('Value changed:', value);
});
Just one custom element - no complex setup required
Works seamlessly with your existing CSS frameworks
Complete programmatic control via JavaScript