Vibary.ai
← Vibe Coding

Currency Input Format

Separators fade in where they belong as the amount groups itself, and the caret holds its place.

formsminimalpremiuminteraction · finite · advanced · ~0.3s
Interactive · click to play
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

325 lines · react + motion only
import { useId, useLayoutEffect, useRef, useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Currency Input Format
 *
 * An amount field that groups itself as it is typed. Each separator
 * fades in where it belongs as the figure regroups around it, and the

About this pattern

An amount field that groups itself without ever losing the typist. Each separator fades in where it belongs as the figure regroups around it, and the caret is put back before paint — counted in typed characters rather than in string positions, which is the only measure that survives a separator appearing to its left. The row is anchored at its right-hand end and its cells are keyed by slot rather than by glyph, so no figure is ever mid-flight under a caret the browser has already moved. Nothing scales and nothing bounces, and the field stays a real input holding the real value.

Amount entry in a payment formTransfer or invoice valueBudget or limit fieldPrice input with grouping

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • Add a supplierTwo fields now, the rest later
    Legal name
    Ridgeline Supply Co.
    Country
    Sweden
    VAT number
    SE556031820101
    Save supplier
    Form

    Transfer amounts group live while the field stays editable mid-number.

Related patterns