AI Autocomplete
ProNewGhost-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
| Prop | Type | Default |
|---|---|---|
| suggestions* | string[]Candidate completions matched against the current prefix. | — |
| label | stringAccessible label for the input. | "Prompt with AI autocomplete" |
| placeholder | string | "Start typing a query…" |
| onAccept | (value: string) => voidCalled whenever a completion is accepted with Tab or submitted. | — |
| className | string | — |
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.