BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/tool-ui/citation

Citation

tool-ui/citation
FreeBlock

Display source references with attribution.

See it running

Open the demo on tool-ui

www.tool-ui.com/components/citation
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://www.tool-ui.com/r/citation.json

Source

components/tool-ui/citation/citation.tsxwww.tool-ui.com/r/citation.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import type { LucideIcon } from "lucide-react";
5import {
6 FileText,
7 Globe,
8 Code2,
9 Newspaper,
10 Database,
11 File,
12 ExternalLink,
13} from "lucide-react";
14import { cn, Popover, PopoverContent, PopoverTrigger } from "./_adapter";
15
16import { openSafeNavigationHref, sanitizeHref } from "../shared/media";
17import type {
18 SerializableCitation,
19 CitationType,
20 CitationVariant,
21} from "./schema";
22
23const FALLBACK_LOCALE = "en-US";
24
25const TYPE_ICONS: Record<CitationType, LucideIcon> = {
26 webpage: Globe,
27 document: FileText,
28 article: Newspaper,
29 api: Database,
30 code: Code2,
31 other: File,
32};
33
34function extractDomain(url: string): string | undefined {
35 try {
36 const urlObj = new URL(url);
37 return urlObj.hostname.replace(/^www\./, "");
38 } catch {
39 return undefined;
40 }
41}
42
43function formatDate(isoString: string, locale: string): string {
44 try {
45 const date = new Date(isoString);
46 return date.toLocaleDateString(locale, {
47 year: "numeric",
48 month: "short",
49 });
50 } catch {
51 return isoString;
52 }
53}
54
55function useHoverPopover(delay = 100) {
56 const [open, setOpen] = React.useState(false);
57 const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
58
59 const handleMouseEnter = React.useCallback(() => {
60 if (timeoutRef.current) clearTimeout(timeoutRef.current);
61 timeoutRef.current = setTimeout(() => setOpen(true), delay);
62 }, [delay]);
63
64 const handleMouseLeave = React.useCallback(() => {
65 if (timeoutRef.current) clearTimeout(timeoutRef.current);
66 timeoutRef.current = setTimeout(() => setOpen(false), delay);
67 }, [delay]);
68
69 React.useEffect(() => {
70 return () => {
71 if (timeoutRef.current) clearTimeout(timeoutRef.current);
72 };
73 }, []);
74
75 return { open, setOpen, handleMouseEnter, handleMouseLeave };
76}
77
78export interface CitationProps extends SerializableCitation {
79 variant?: CitationVariant;
80 className?: string;
81 onNavigate?: (href: string, citation: SerializableCitation) => void;
82}
83
84export function Citation(props: CitationProps) {
85 const { variant = "default", className, onNavigate, ...serializable } = props;
86
87 const {
88 id,
89 href: rawHref,
90 title,
91 snippet,
92 domain: providedDomain,
93 favicon,
94 author,
95 publishedAt,
96 type = "webpage",
97 locale: providedLocale,
98 } = serializable;
99
100 const locale = providedLocale ?? FALLBACK_LOCALE;
101 const sanitizedHref = sanitizeHref(rawHref);
102// … truncated

What it pulls in

npm packages

  • lucide-react
  • zod

Other registry items

  • popover

Files it writes

  • components/tool-ui/citation/_adapter.tsx
  • components/tool-ui/citation/citation-list.tsx
  • components/tool-ui/citation/citation.tsx
  • components/tool-ui/citation/index.ts
  • components/tool-ui/citation/README.md
  • components/tool-ui/citation/schema.ts
  • components/tool-ui/shared/contract.ts
  • components/tool-ui/shared/media/aspect-ratio.ts
  • components/tool-ui/shared/media/format-utils.ts
  • components/tool-ui/shared/media/index.ts
  • components/tool-ui/shared/media/overlay-gradient.ts
  • components/tool-ui/shared/media/safe-navigation.ts
  • components/tool-ui/shared/media/sanitize-href.ts
  • components/tool-ui/shared/parse.ts
  • components/tool-ui/shared/schema.ts

Facts

Registry
tool-ui
Type
registry:block
Access
Free
Files written
15
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

Docs on tool-ui www.tool-ui.com Raw registry item This item as JSON

More from tool-ui

All 27 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Approval Cardapproval-cardtool-uiBlocksFree2 deps · 11 files
Audioaudiotool-uiBlocksFree2 deps · 9 files
Chartcharttool-uiBlocksFree2 deps · 8 files
Code Blockcode-blocktool-uiBlocksFree3 deps · 11 files
Code Diffcode-difftool-uiBlocksFree3 deps · 10 files
Data Tabledata-tabletool-uiBlocksFree1 dep · 17 files
Geo Mapgeo-maptool-uiBlocksFree4 deps · 12 files
Imageimagetool-uiBlocksFree1 dep · 14 files

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

KitGrade

SaaS starter kits, scored from measured facts

kitgrade.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and KitGrade

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex