Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

AI Autocomplete

ProNew

Ghost-text inline AI autocomplete input with Tab-to-accept highlight pulse and Up/Down suggestion cycling.

Installation

pnpm dlx shadcn@latest add @viewport/ai-autocomplete

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
suggestions*string[]

Candidate completions matched against the current prefix.

—
labelstring

Accessible label for the input.

"Prompt with AI autocomplete"
placeholderstring"Start typing a query…"
onAccept(value: string) => void

Called whenever a completion is accepted with Tab or submitted.

—
classNamestring—

Accessibility

  • Built on a real labelled text input; ghost completion is aria-hidden.
  • Tab accepts and Up/Down cycles suggestions without stealing focus.
  • Ghost fade and accept highlight respect prefers-reduced-motion.