Skip to content
Sign in
KnowledgeKnowledge graphMenu

Knowledge graphPro

Entities and relations laid out once, deterministically, then still, with search and focus.

ProCompanies, people and products from filings. Search, or focus an entity.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/knowledge-graph

Usage

tsx
import { KnowledgeGraph } from "@/components/ui/chatcn/pro/knowledge-graph"

<KnowledgeGraph entities={entities} relations={relations} />

The layout runs a seeded force simulation to rest before the first paint, so the same graph always lands the same way and nothing drifts while you read. Search lights matches and their neighbors. Focusing an entity dims the rest and lists its relations as text, where each related entity is a link to focus next.

Examples

States

ProFocused on one entity, and a small graph.

Props

PropTypeNotes
entities{ id, label, type }[]Nodes
relations{ from, to, label }[]Edges
seednumberSame seed, same layout
focusId, onFocusChangestring | nullControlled focus
heightnumberDefault 420

Accessibility

  • Every entity is a button; the relations panel is a polite live region and the keyboard path through the graph.
  • Search has a label for assistive tech.