Command Palette
Search for a command to run...
Loading component...
Auto Scale input
An auto-scaling input for big number entry. Uses the responsive font approach seen in Uniswap and Wise so large amounts stay readable in crypto and finance apps without overflowing.
Dependencies
Interaction Type
| Enter a number | |
| Watch text auto-scale |
CLI UNAVAILABLE
pro component, try copying the source code from top right cornerHow to use
Use AutoscaleInput when you need a big, responsive amount field. Apps like Uniswap and Wise scale the input font down as the value grows so swap amounts, transfer values, and balances stay readable without breaking the layout. This is a common pattern in crypto and finance apps where the input is the main focus.
Basic usage
import { AutoscaleInput } from "@/components/v1/skiper105"; const PriceInput = () => ( <AutoscaleInput numberFormat="us" prefix="$" placeholder="0.00" aria-label="Price" /> );
Controlled
import { useState } from "react"; import { AutoscaleInput } from "@/components/v1/skiper105"; const ControlledInput = () => { const [amount, setAmount] = useState("1,234.56"); return ( <AutoscaleInput value={amount} onChange={(e) => setAmount(e.target.value)} numberFormat="us" prefix="$" /> ); };
Uncontrolled
<AutoscaleInput defaultValue="50000" numberFormat="in" prefix="₹" name="salary" />
Locale formats
<AutoscaleInput numberFormat="eu" prefix="€" suffix="/mo" /> <AutoscaleInput numberFormat="ch" prefix="CHF " /> <AutoscaleInput numberFormat="space" prefix="" /> <AutoscaleInput numberFormat="string" placeholder="Type anything…" />
Standard input props
<AutoscaleInput id="budget" name="budget" disabled={isLoading} readOnly={isLocked} autoFocus onBlur={(e) => console.log(e.target.value)} onKeyDown={(e) => e.key === "Enter" && e.currentTarget.blur()} className="text-primary" wrapperClassName="justify-start" containerClassName="max-w-lg" />
Props | Description |
|---|---|
…input props | All native input attributes are supported and forwarded to the inner `<input>` (e.g. disabled, readOnly, name, id, onBlur, onFocus, onKeyDown, aria-*) |
numberFormat | Locale number format: US, EU, SPACE, CH, IN, NONE, or STRING (free text, no formatting) |
prefix | Prepended adornment (e.g. $, €, ₹). Scales with the input font size. |
suffix | Appended adornment (e.g. USD, /mo). Scales with the input font size. |
placeholder | Empty-state text; auto-derived from numberFormat when omitted |
minSize | Minimum auto-scale font size in px (default 18) |
maxSize | Maximum auto-scale font size in px (default 100) |
value | Controlled formatted value |
defaultValue | Initial value for uncontrolled usage |
onChange | Called with the formatted value in e.target.value |
className | Classes applied to the inner `<input>` |
wrapperClassName | Classes applied to the flex row wrapping prefix, input, and suffix |
containerClassName | Classes applied to the outer width-constrained container |
DialKit setup
AutoscaleInput uses DialKit for live parameter tweaking. See the DialKit docs for installation and DialRoot setup.
Notes
- Number formats:
1,234,567.89 (US),1.234.567,89 (EU),1 234 567,89 (SPACE),1'234'567.89 (CH),12,34,567.89 (IN),1234567.89 (NONE), orAny text (STRING)for unformatted input onChangealways receives the formatted display value (e.g.1,234.56), not raw digits- Prefix and suffix fade to 20% opacity when the input is empty
- Font size scales down automatically as the value grows;
ResizeObserverkeeps sizing in sync when the container width changes - Use the Autoscale Input DialKit panel to tweak format, placeholder, font bounds, and input layout (max width, padding)
Attribution
Source code
Keep in mind
Most components here are recreations of the best out there. I don't claim to be the original creator. This is my attempt to reverse-engineer, replicate, and often add a few extra features. I've tried to credit everyone, but if I missed something, let me know.
Contact
License & Usage:
- Free to use and modify in both personal and commercial projects.
- Attribution to Skiper UI is required when using the free version.
- No attribution required with Skiper UI Pro.