---
title: "Auto Scale Input"
description: "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."
url: https://gelatinui.com/components/auto-scale-input
markdown_url: https://gelatinui.com/components/auto-scale-input.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/auto-scale-input"
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Auto Scale Input

> 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.

Page: https://gelatinui.com/components/auto-scale-input

## When to use it

Best for: The one big amount of a payment or transfer screen, where the value must stay in view.

- 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.

## When not to use it

- For a number with step buttons, use a [Number Field](https://gelatinui.com/components/number-field.md).
- For a normal text field in a form, use an [Input](https://gelatinui.com/components/input.md).

## Notes for agents

- `mask` is required. Build it once, at module level or in a memo.
- `value` and `defaultValue` are the shown text. The raw number comes in `onValueChange` details.
- The text shrinks from `maxFontSize` (56) to `minFontSize` (24). Past the min size, the field scrolls to the caret.
- The value row is always left to right, also on a right-to-left page.
- There is no focus ring: the caret shows the focus.

## Anatomy

```text
AutoScaleInput
```

## API reference

### AutoScaleInput

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `mask` | `MaskPreset<Raw>` |  | A number preset from `#/lib/masks` (`currency`, `number`, `percent`, `unit`). Build it once. |
| `value` | `string` |  | The shown value (controlled), formatted by the mask: "1250" shows "1,250". |
| `defaultValue` | `string` |  | The first shown value (uncontrolled), formatted by the mask. |
| `onValueChange` | `function` |  | Runs on every change with the shown value, the raw value, and the checks. |
| `maxFontSize` | `number` | 56 | The text size while the whole value fits, in px. Default `56`. |
| `minFontSize` | `number` | 24 | The 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`. |
| `rejectFeedback` | `boolean` | true | Nudge the value 2px when the mask rejects a key. Default `true`. |
| `onReject` | `function` |  | Runs when the mask rejects a key (a letter, a third decimal, a digit past max). |
| `rawName` | `string` |  | Also submit the raw value under this name (a hidden input), next to the shown one. |
| `className` | `string` |  | Classes of the root box (its width is the room the value fits in). |
| `ref` | `Ref<HTMLInputElement>` |  |  |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| AutoScaleInput | `auto-scale-input` | `data-align`, `data-empty`, `data-invalid`, `data-scrolled` | `--auto-scale-input-max`, `--auto-scale-input-size` | `status-colors` |

## Usage

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

```tsx title="send-amount.tsx"
import { AutoScaleInput } from "@/components/ui/pro/auto-scale-input";
import { currency } from "@/lib/masks";

const USD = currency("USD");

export function SendAmount() {
  return (
    <AutoScaleInput
      aria-label="Amount to send"
      mask={USD}
      defaultValue="1250"
      onValueChange={(value, details) => {
        console.log(details.unmasked);
      }}
    />
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/auto-scale-input
```

It adds 14 registry items: 13 files, 3039 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `@maskito/core`, `@maskito/kit`, `@maskito/react`, `clsx`, `motion`, `tailwind-merge`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Number Field](https://gelatinui.com/components/number-field.md)
- [Input](https://gelatinui.com/components/input.md)
- [Field](https://gelatinui.com/components/field.md)

## Accessibility

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.

## Motion

| Part | Motion |
| --- | --- |
| 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 |
