
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
react-knowledge-graph
Advanced tools
a react component that can help you create a dynamic knowledge-graph built with Next.js.
English | 简体中文
a react component that can help you create a dynamic knowledge-graph built with Next.js
.
react
or use dom
type NodeProps = {
id: string;
name: string; // 节点名称
type: string; // 节点类型
hasMore: boolean; // 是否有子节点
direction: "root" | "inside" | "outside";
};
type EdgeProps = {
id: string; // 边id
fromId: string;
toId: string;
description: string;
};
Need to accept an asynchronous function, this library will return the parameter
id - Node Id
,node - current node
Need to returninside
in edge node,outside
out edge node,edge
array of edges
type explore = (id: React.Key) => Promise<{
inside: Node.NodeProps[];
outside: Node.NodeProps[];
edge: Edge.EdgeProps[];
}>;
npm install react-knowledge-graph
# or
yarn add react-knowledge-graph
import style files in the top file:
import "react-knowledge-graph/KnowledgeGraph/index.css";
Next:
<KnowledgeGraph
explore={explore}
basicDistence={width}
position={{ x: 100, y: 100 }}
node={{
id: "node-0",
type: "根节点",
hasMore: true,
direction: "root",
name: "根节点",
}}
onExploreEnd={() => {
message.info("已经到尾节点了!");
}}
edgeConfig={{
hoveredColor: "#e27272",
stroke: "#DEDEDE",
strokeWidth: 1,
}}
typeConfig={{
根节点: {
radius: 20,
fill: "#747ba6",
hoverStyle: {
fill: "#3949a3",
},
},
model: {
radius: 15,
fill: "#b4e5a2",
typeSize: 8,
nameSize: 8,
hoverStyle: {
fill: "#6be73e",
},
},
data: {
radius: 15,
fill: "#ea52ea",
typeSize: 8,
nameSize: 8,
hoverStyle: {
fill: "#e5a2e5",
},
},
test: {
radius: 13,
fill: "#89c4fb",
typeSize: 8,
nameSize: 8,
hoverStyle: {
fill: "#2f8fe8",
},
},
}}
/>
FAQs
a react component that can help you create a dynamic knowledge-graph built with Next.js.
The npm package react-knowledge-graph receives a total of 24 weekly downloads. As such, react-knowledge-graph popularity was classified as not popular.
We found that react-knowledge-graph demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.