Ghost Complete

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/input-ghost

About this component

An email field that finishes the domain for you. Type the @ and the rest of a likely address appears in grey after your caret with a Tab key hint; Tab (or the right arrow, or tapping the hint) washes the ghost text solid and it becomes part of what you typed.

Triggers

  • Focus
  • State change
  • Icon

Techniques

  • CSS transition
  • State machine

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

The input is labelled "Email". Tab only accepts while a suggestion is showing, otherwise it moves focus as usual. A polite live region announces each new suggestion once ("Suggestion: gmail.com. Press Tab to accept.") and the completed address. The ghost and key hint are aria-hidden.

Use it in anything you build, commercial and client work included. Licence

More inputs

See all

Handle CheckGet code
Lens SearchGet code
Guests
Drag the number to scrub
OdometerGet code
PeekGet code