Animated Input
unlumen-ui/animate-text-input-typingPaidComponent
An animated text input with per-character motion and a cursor that springs between typing and selection states.
Live preview
live · rendered by the registry
Rendered by Unlumen Ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.unlumen.com/r/animate-text-input-typing.jsonSource
1"use client";23import React, {4 useCallback,5 useEffect,6 useRef,7 useState,8 forwardRef,9} from "react";10import {11 motion,12 MotionConfig,13 AnimatePresence,14 type TargetAndTransition,15 type Transition,16} from "motion/react";1718type CharAnimDef = {19 initial: TargetAndTransition;20 animate: TargetAndTransition;21 exit: TargetAndTransition;22 transition: Transition;23};24import { cn } from "@/lib/utils";2526// ---------------------------------------------------------------------------27// Types28// ---------------------------------------------------------------------------2930interface CursorRect {31 x: number;32 y: number;33 width: number;34 height: number;35}3637type CursorState =38 | { type: "hidden" }39 | { type: "caret"; rect: CursorRect }40 | { type: "selection"; rects: CursorRect[] };4142/**43 * Character entrance/exit animation preset.44 *45 * - `spring` — scale + fade with a springy bounce (default)46 * - `bounce` — exaggerated spring overshoot47 * - `fade` — simple opacity only48 * - `slide` — slides up from below49 * - `wave` — per-char cascading slide (uses CSS delay via index)50 * - `typewriter` — instant appear/disappear, no animation51 */52export type CharAnimation =53 | "spring"54 | "bounce"55 | "fade"56 | "slide"57 | "wave"58 | "typewriter";5960/**61 * Visual style of the cursor caret.62 *63 * - `line` — thin vertical bar (default)64 * - `block` — full-height filled block behind the char65 * - `underline` — thin horizontal bar beneath the char66 * - `glow` — line with a blurred glow halo67 */68export type CursorVariant = "line" | "block" | "underline" | "glow";6970/**71 * Pre-built visual preset for the input field itself.72 * Applies a `fieldClassName` baseline that can be overridden.73 *74 * - `default` — rounded border on dark bg75 * - `ghost` — no border, subtle bg76 * - `outline` — border only, transparent bg77 * - `filled` — solid neutral fill, no border78 * - `terminal` — monospace, dark green on near-black79 * - `minimal` — bottom border only (underline style)80 * - `pill` — heavily rounded, soft bg81 */82export type InputVariant =83 | "default"84 | "ghost"85 | "outline"86 | "filled"87 | "terminal"88 | "minimal"89 | "pill";9091// ---------------------------------------------------------------------------92// Preset maps93// ---------------------------------------------------------------------------9495const CHAR_ANIMATION_MAP: Record<CharAnimation, CharAnimDef> = {96// … truncated
What it pulls in
npm packages
More from Unlumen Ui
All 233 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Chatai-chat | Unlumen Ui | Components | Paid | 2 deps | |
| Vercel Animate Countanimate-count | Unlumen Ui | Components | Free | 1 dep | |
| Animate Digitsanimate-digits | Unlumen Ui | Components | Free | 1 dep | |
| Animated Listanimated-list | Unlumen Ui | Components | Free | 1 dep | |
| Apple Switchapple-switch | Unlumen Ui | Components | Free | 1 dep | |
| Aurora Barsaurora-bars | Unlumen Ui | Components | Free | 1 dep | |
| Aurora Bluraurora-blur | Unlumen Ui | Components | Free | 2 deps | |
| Aurora Cardaurora-card | Unlumen Ui | Components | Paid | 2 deps |
