AI Inline Citations - React Component | Kokonut UI
AI Inline Citations
An answer with source chips beside each claim. One preview glides between chips and lights up the sentence it backs.
Install with:
npx shadcn@latest add https://kokonutui.com/r/ai-citations.json
Then show me how to use it.
Installation
AI Inline Citations is a free, open-source React component in the Kokonut UI AI collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/ai-citations.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/ai-citations
Or add it by hand: install its packages, then copy the source from the command above into components/kokonutui/ai-citations.tsx.
npm install lucide-react motion
Usage
import AICitations from "@/components/kokonutui/ai-citations";
export default function Example() {
return <AICitations />;
}
Props
parts
AnswerPart[]Defaultdemo data
The answer, split where citations go. Demo content when omitted.
sources
CitationSource[]Defaultdemo data
className
string
Extra classes for the root element.
AnswerPart
textrequiredstring
citestring[]
Ids of the sources that back this text. A chip follows it.
CitationSource
idrequiredstring
titlerequiredstring
urlrequiredstring
sitestring
Short site name for the chip, such as MDN. Defaults to the host.
snippetstring
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react |
^0.556.0 |
npm, installed by the CLI |
motion |
^12.23.25 |
npm, installed by the CLI |
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font, or global CSS to set up: the file works as soon as it lands.
Additional Context
AI Context Meter - How full the context window is, as a ring in the prompt footer that opens a breakdown by source and compacts when it fills.
AI Diff Review - A coding agent's edits streaming in file by file, then reviewed per file with accept, reject and undo.