Skip to content

Auto Scale Input

Pro

A large amount field. The text gets smaller as you type, so the whole value stays in view. A number mask formats it and gives you the raw number.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Auto Scale Input needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
12
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

Build the mask once, outside the component. The raw number comes in the details of onValueChange.

send-amount.tsx

AutoScaleInput

<div>
PropTypeDefaultDescription
maskRequiredMaskPreset<Raw>—A number preset from #/lib/masks (currency, number, percent, unit). Build it once.
valuestring—The shown value (controlled), formatted by the mask: "1250" shows "1,250".
defaultValuestring—The first shown value (uncontrolled), formatted by the mask.
onValueChange—Runs on every change with the shown value, the raw value, and the checks.
maxFontSizenumber56The text size while the whole value fits, in px. Default 56.
minFontSizenumber24The smallest text size, in px. Past it the field scrolls to the caret. Default 24.
align"center""start""center"Where the value sits in the field: center (default) or start.
rejectFeedbackbooleantrueNudge the value 2px when the mask rejects a key. Default true.
onReject—Runs when the mask rejects a key (a letter, a third decimal, a digit past max).
rawNamestring—Also submit the raw value under this name (a hidden input), next to the shown one.
classNamestring—Classes of the root box (its width is the room the value fits in).
refRef<HTMLInputElement>—
...props<div> attributes—Every other attribute goes to the <div>.
  • Use it for the main amount of a screen, such as a transfer or a top-up.
  • Pass a number preset of @/lib/masks: currency, number, percent, or unit.
  • Read the raw number in onValueChange, or send it with a form through rawName.
  • Put it in a Field for the label, the description, and the error.
  • For a number with step buttons, use a Number Field.
  • For a normal text field in a form, use an Input.

It is a Base UI Input with the inputMode of the mask, so phones show the number keyboard.

Give it a name with aria-label, or put it in a Field with a FieldLabel.

The currency sign and the unit are text next to the input, at the same size.

Text size
glide · spring (stiffness 700, damping 53) · the size follows the value with no React render per frame
Rejected key
indicator · 200ms · ease-panel (0.2, 0.4, 0.2, 1) · the value moves 2px and back
  1. AddedAuto Scale Input.
Open the release