Solid numeric input
Numora is a Solid numeric input library. It handles thousand separators, decimal limits, paste sanitization, scientific-notation expansion and cursor preservation through a use:numora directive that mounts directly on an <input>. Write the raw value into a createSignal setter, and Solid's fine-grained reactivity updates whatever reads the signal. You need no numora-solid wrapper and no peer dependencies. The vanilla package is framework-agnostic TypeScript, 8.3 kB gzipped, with zero runtime dependencies.
Installation
Solid directive
NumoraInput attaches directly to an existing <input> element. Solid's use: directives bind that lifecycle to a DOM node. Add this helper to your project once, and every <input use:numora={opts}> works.
src/directives/numora.ts:
Component:
The directive gets the <input> and an accessor for its options. Numora adopts the input and sets the attributes it needs. onValueChange receives { value, formattedValue }, where value is the raw string (see value types). By default, Numora formats on every keystroke (see formatting).
Read the value from onValueChange, not from the element's value. That value is the display string ("1,234.56"). onValueChange gives you the raw value ("1234.56").
Animated example: Numora + Torph in Solid
Stack a Torph TextMorph over a transparent-text NumoraInput. The Torph integration explains the overlay and has the shared CSS and install steps. Below is the Solid component.
Solid does not scope CSS by default, so the overlay selectors from the Torph page work as-is.
FAQ
What is the best Solid numeric input library?
Numora is framework-agnostic TypeScript, 8.3 kB gzipped, with no runtime dependencies. In Solid you write a use:numora directive once, then use <input use:numora={opts} /> anywhere.
Is there a numora-solid package?
No, and you do not need one. The use:numora directive is the entire Solid adapter.
Does Numora work with SolidStart and SSR?
Yes. The use:numora directive only runs on the client. SolidStart renders the empty <input> on the server and Numora adopts it on hydration. You need no SolidStart-specific configuration.
How do I add thousand separators to a Solid number input?
Nothing to configure. Grouping on every keystroke is the default. Numora formats as the user types and keeps the cursor between the same two digits when it inserts a comma. onValueChange receives { value, formattedValue }, where value is the raw value without separators, which you can write straight into a createSignal setter.
Does it support i18n (decimal commas, locale grouping) in Solid?
Yes. Set decimalSeparator: ',' and thousandSeparator: '.' (or use the locale option) for European formats. The raw value is a plain dot-decimal string in every locale.
Why not a plain signal-bound <input>?
A plain signal-bound input has no thousand separators, decimal limits or paste sanitization, and you would have to write the cursor-positioning logic yourself. Numora handles all of it.
Can I animate digits in Solid?
Yes. The Torph + Numora overlay pattern is vanilla DOM, so it works inside any Solid component. Torph respects prefers-reduced-motion by default.