Citation
An inline source pill with a trusted-source shield, label and +N count.
import { Card } from "@/components/ui/card";
import { PerplexityCitation } from "../components/perplexity-citation";
import { PerplexityMessage } from "../components/perplexity-message";
import type { PerplexityCitationSource } from "../types/perplexity";
const TECHCRUNCH_SOURCES: PerplexityCitationSource[] = [
{
description:
"Notion acquires the encrypted email and productivity startup.",
domain: "techcrunch.com",
title: "Notion acquires Skiff",
url: "https://techcrunch.com/",
},
{
domain: "theverge.com",
title: "Skiff is shutting down after the Notion deal",
url: "https://www.theverge.com/",
},
{
domain: "notion.com",
title: "Welcoming the Skiff team to Notion",
url: "https://www.notion.com/",
},
];
const VERGE_SOURCES = TECHCRUNCH_SOURCES.slice(1, 2);
export default function PerplexityCitationExample() {
return (
<Card className="bg-pplx-bg ring-pplx-border w-full min-w-0 gap-0 rounded-2xl p-6">
<PerplexityMessage from="assistant">
On February 9, 2024, Notion acquired the encrypted productivity startup
Skiff.
<PerplexityCitation
extra={2}
label="techcrunch"
sources={TECHCRUNCH_SOURCES}
/>
Skiff's services were wound down afterwards.
<PerplexityCitation label="theverge" sources={VERGE_SOURCES} />
</PerplexityMessage>
</Card>
);
}
$ bunx --bun shadcn@latest add @notra/perplexity-citationThe pill is a shadcn Badge in a small monospace face, like Perplexity’s. It shows a shield, the short source name and an optional +N.
| Prop | Default | Description |
|---|---|---|
label |
The source name, truncated at 9rem. | |
extra |
Adds a +N count for more sources. |
Used in
Perplexity
A full recreation of a Perplexity thread with search steps, citations with hover cards and the composer.