Skip to content
Notra logoNotra UI
Esc
↑↓navigate↵open⌘Jpreview
On this page

Source Chip

An inline citation pill that opens a hover card with the cited sources.

import { Card } from "@/components/ui/card";

import { ChatgptSourceChip } from "../components/chatgpt-source-chip";
import { CHATGPT_STORY_SOURCES } from "../constants/chatgpt-story";

export default function ChatgptSourceChipExample() {
  return (
    <Card className="border-chatgpt-border bg-chatgpt-bg font-chatgpt text-chatgpt-fg flex w-full min-w-0 flex-col gap-3 rounded-2xl border p-6 text-base leading-7 ring-0">
      <p>
        G7 foreign ministers are weighing new sanctions in Ottawa.
        <ChatgptSourceChip sources={CHATGPT_STORY_SOURCES.slice(0, 1)} />
      </p>
      <p>
        Markets opened higher after strong US tech earnings.
        <ChatgptSourceChip sources={CHATGPT_STORY_SOURCES.slice(3, 4)} />
      </p>
    </Card>
  );
}
$ bunx --bun shadcn@latest add @notra/chatgpt-source-chip

ChatgptSourceChip shows the first publisher with a +N for the rest, set inline at the end of a claim. Hovering it opens a shadcn HoverCard that lists up to three sources, each with a favicon, publisher, title and a two-line snippet. The chip links to the first source’s href when it has one.

Prop Default Description
sources The cited ChatgptActivitySources. Nothing renders when it is empty.

Used in

ChatGPT

A full recreation of a ChatGPT conversation with thinking, web search, reasoning and the model picker.