Components

Data Stream

A flowing data visualization effect for React: packets stream along horizontal lanes at different speeds, with thin fading tails and short data blocks. Drawn on a high-DPI canvas, a lightweight hero accent for real-time, networking and AI products.

  • Background
  • Canvas
  • High-DPI
  • Pauses off-screen
  • Reduced-motion safe

Event streaming

Publish and consume events with ordering guarantees per key.

Installation

$ npx shadcn@latest add https://duskui.com/r/data-stream.json

The stream fills its nearest positioned parent. Give the parent relative and a height, then place content after it with relative.

Usage

hero.tsx
import { DataStream } from "@/components/dusk/techy/data-stream"

export function Hero() {
  return (
    <section className="relative h-96 overflow-hidden">
      <DataStream lanes={14} />
      <div className="relative">{/* your content */}</div>
    </section>
  )
}

Examples

Section divider

A short container with a few lanes makes an animated divider. direction="left" reverses the flow.

A thin band of lanes makes an animated section divider.

Network monitor

Push lanes, speed and density up for a busy, dashboard-style traffic view.

Throughput
8.2 GB/s
Packets
1.4M/s
Latency
6 ms

API Reference

Any other div prop is passed to the root.

PropTypeDefaultDescription
colorstring"var(--color-primary)"Packet color. Any CSS color, including variables and oklch().
lanesnumber10Number of horizontal lanes.
speednumber1Speed multiplier; each lane also gets its own random speed.
densitynumber0.35How busy each lane is, from 0 to 1.
direction"left" | "right""right"Which way the data flows.
fadebooleantrueFade the stream out at both ends.
classNamestring—Merged onto the absolutely positioned root.

Accessibility

  • Decorative only: the root is aria-hidden and pointer-events-none.
  • With prefers-reduced-motion a single still frame is drawn instead of the animation.
  • The animation loop stops while the stream is off-screen or the tab is hidden, and is cancelled on unmount.
  • The canvas is sized for the device pixel ratio and follows its container with a ResizeObserver, so there is no layout shift.