BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn-collections/source

Source

shadcn-collections/source
FreeComponent

Source viewer component

Install it

npx shadcn@latest add https://chatcn.me/r/source.json

Source

components/chatcn/ai/source.tsxchatcn.me/r/source.json
1"use client";
2import React, { createContext, useContext } from "react";
3import {
4 HoverCard,
5 HoverCardContent,
6 HoverCardTrigger,
7} from "@/components/ui/hover-card";
8import { cn } from "@/lib/utils";
9
10type SourceContextType = {
11 href: string;
12 label?: string | number;
13};
14
15const SourceContext = createContext<SourceContextType | null>(null);
16
17function useSourceContext() {
18 const context = useContext(SourceContext);
19 if (!context) {
20 throw new Error("useSourceContext must be used within a Source component");
21 }
22 return context;
23}
24
25export type SourceProps = {
26 href: string;
27 label?: string | number;
28 children: React.ReactNode;
29};
30
31function getDomainFromUrl(url: string): string {
32 try {
33 const urlObj = new URL(url);
34 return urlObj.hostname;
35 } catch {
36 return url;
37 }
38}
39
40export function Source({ href, label, children }: SourceProps) {
41 return (
42 <SourceContext.Provider value={{ href, label }}>
43 <HoverCard openDelay={150} closeDelay={0}>
44 {children}
45 </HoverCard>
46 </SourceContext.Provider>
47 );
48}
49
50export type SourceTriggerProps = {
51 showFavicon?: boolean;
52 className?: string;
53 label?: string | number;
54};
55
56export function SourceTrigger({
57 showFavicon = true,
58 className,
59 label: propLabel,
60}: SourceTriggerProps) {
61 const { href, label: contextLabel } = useSourceContext();
62 const displayLabel = propLabel ?? contextLabel;
63
64 return (
65 <HoverCardTrigger asChild>
66 <a
67 href={href}
68 target="_blank"
69 rel="noopener noreferrer"
70 className={cn(
71 "bg-muted text-muted-foreground hover:bg-muted-foreground/30 hover:text-primary inline-flex h-5 max-w-32 items-center gap-1 overflow-hidden rounded-full py-1 text-xs leading-none no-underline transition-colors duration-150",
72 showFavicon ? "pr-2 pl-1" : "px-1",
73 className
74 )}
75 >
76 {showFavicon && (
77 // eslint-disable-next-line @next/next/no-img-element
78 <img
79 src={`https://www.google.com/s2/favicons?sz=64&domain_url=${encodeURIComponent(
80 href
81 )}`}
82 alt="favicon"
83 width={14}
84 height={14}
85 className="size-3.5 rounded-full"
86 />
87 )}
88 <span className="truncate text-center font-normal">
89 {displayLabel ?? getDomainFromUrl(href)}
90 </span>
91 </a>
92 </HoverCardTrigger>
93 );
94}
95
96export type SourceContentProps = {
97 title: string;
98 description: string;
99// … truncated

What it pulls in

Other registry items

  • tooltip

Files it writes

  • components/chatcn/ai/source.tsx

Facts

Registry
shadcn-collections
Type
registry:component
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
yesterday

Go to the source

chatcn.me sankalpaacharya/chatcn on GitHub Raw registry item This item as JSON

More from shadcn-collections

All 24 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Audio Visualizeraudio-visualizershadcn-collectionsComponentsFree4 deps
Calendarcalendarshadcn-collectionsComponentsFreeno deps
Chat Containerchat-containershadcn-collectionsComponentsFreeno deps
Code Editorcode-editorshadcn-collectionsComponentsFreeno deps
Code Blockcodeblockshadcn-collectionsComponentsFree1 dep
Command Blockcommand-blockshadcn-collectionsComponentsFreeno deps
Command Tabscommand-tabsshadcn-collectionsComponentsFreeno deps
Emailemailshadcn-collectionsComponentsFreeno deps

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