Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Sankey

sankey

Visualizes weighted flow between stages with proportional nodes and links.

Usage

Basic usage

nodes/links is controlled; when layer is not given, the topology is automatically layered according to links (source layer < target layer), and the flow width is based on value proportion. per-node tone eats the token variable.

Text generation
Code Task
Image Task
Smart Router
Haiku pool
Sonnet Pool
Opus Pool
tsx
<Sankey
  nodes={[
    { id: "text", label: "Text generation", tone: "var(--color-chart-1)" },
    { id: "code", label: "Code Task", tone: "var(--color-chart-2)" },
    { id: "router", label: "Smart Router", tone: "var(--color-primary)" },
    { id: "haiku", label: "Haiku Pool", tone: "var(--color-chart-4)" },
    { id: "sonnet", label: "Sonnet Pool", tone: "var(--color-chart-5)" },
  ]}
  links={[
    { source: "text", target: "router", value: 42 },
    { source: "code", target: "router", value: 28 },
    { source: "router", target: "haiku", value: 38 },
    { source: "router", target: "sonnet", value: 30 },
  ]}
  height={300}
/>

Item by item tooltip

renderTooltip distinguishes two types of hover targets: node / link. Follow the pointer to display details.

Text generation
Code Task
Image Task
Smart Router
Haiku pool
Sonnet Pool
Opus Pool
tsx
<Sankey
  nodes={nodes}
  links={links}
  height={300}
  renderTooltip={(item) =>
    item.type === "node" ? (
      <span>{item.node.label}</span>
    ) : (
      <span>{item.link.source} → {item.link.target}: {item.link.value}</span>
    )
  }
/>

Bold node strips + flow adjustment with transparency

nodeWidth enlarges the node rectangle width, linkOpacity adjusts the flow band stroke transparency.

Monthly Budget
Reasoning
Vector search
Tool call
Anthropic
DeepSeek
tsx
<Sankey
  nodes={nodes}
  links={links}
  height={300}
  nodeWidth={24}
  linkOpacity={0.5}
/>

When to use

Use Sankey to show allocation or conversion across multiple directed layers, such as task routing, budget distribution, or traffic sources. Use Funnel for one linear attrition path, or [Table]/[ProTable] for flat records.

Import

ts
import { Sankey, assignLayers, computeSankeyLayout } from "@hulianui/ui"

Props

NameTypeDefaultDescription
nodes*SankeyNode[]-{id, label?, layer?, tone?} nodes. Layers are inferred topologically when omitted.
links*SankeyLink[]-{source, target, value, tone?} links whose ribbon width follows value.
heightnumber320Container height.
nodeWidthnumber16Node rectangle width.
nodePaddingnumber12Vertical spacing between same-layer nodes.
linkOpacitynumber0.35Ribbon opacity, raised to 0.6 on hover.
classNamestring-Root class name.

Events

EventTypeDescription
onNodeClick(node: SankeyLaidNode) => voidNode drill-down.
onLinkClick(link: SankeyLaidLink) => voidLink drill-down.

Slots

SlotTypeDescription
renderNodeLabel(node: SankeyLaidNode) => ReactNodeCustom node label.
renderTooltip(item: {type:"node";node} | {type:"link";link}) => ReactNodeCustom node or link hover tooltip.

Example

tsx
const nodes: SankeyNode[] = [
  { id: "text", label: "Text generation", tone: "var(--color-chart-1)" },
  { id: "router", label: "Smart router", tone: "var(--color-primary)" },
  { id: "haiku", label: "Haiku pool", tone: "var(--color-chart-4)" },
];
const links: SankeyLink[] = [
  { source: "text", target: "router", value: 42 },
  { source: "router", target: "haiku", value: 38 },
];

<Sankey
  nodes={nodes}
  links={links}
  height={300}
  renderTooltip={(item) => item.type === "node"
    ? <span>{item.node.label}</span>
    : <span>{item.link.source} → {item.link.target}: {item.link.value}</span>}
/>

Usage notes

  • SVG tones require full token names such as var(--color-chart-3); see [[hulian-token-color-var-needs-color-prefix]].
  • computeSankeyLayout produces laid-out coordinates and assignLayers infers topology. Do not pass cyclic links because layering assumes a DAG.
  • The root uses built-in Chinese aria-label "\u6851\u57fa\u6d41\u5411\u56fe", meaning “Sankey flow diagram.”

Related

The chart accessibility label follows ConfigProvider.
Table · Book3D · ProTable · PricingTable · JsonViewer · EditableTable

Playground

Text generation
Code Task
Image Task
Smart Router
Haiku pool
Sonnet Pool
Opus Pool
<Sankey
  nodes={[
    { id: "text", label: "Text generation", tone: "var(--color-chart-1)" },
    { id: "router", label: "Smart Router", tone: "var(--color-primary)" },
    { id: "haiku", label: "Haiku Pool", tone: "var(--color-chart-4)" },
  ]}
  links={[
    { source: "text", target: "router", value: 42 },
    { source: "router", target: "haiku", value: 38 },
  ]}
  height={300}
  nodeWidth={16}
  linkOpacity={0.35}
/>
PreviousComponentPickerData DisplayNextSparkline

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Slots
    • Example
    • Usage notes
    • Related
  • Playground