Airbnb

Linktypes

Component 94

About

here is fully customizable link types of data

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Linktypes to your project and fits it to your theme.

Code

How Linktypes is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import React, { useEffect, useRef, useState } from "react";
import TreeChart from "@/components/ui/linktypes";

const settings = {
  layout: "cartesian",
  orientation: "horizontal",
  linkType: "diagonal",
  stepPercent: 0.5,
};

export default function Demo(props: Partial<typeof settings>) {
  const s = { ...settings, ...props };
  const ref = useRef<HTMLDivElement>(null);
  const [size, setSize] = useState({ width: 0, height: 0 });

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    const update = () =>
      setSize({ width: el.clientWidth, height: el.clientHeight });
    update();
    const ro = new ResizeObserver(update);
    ro.observe(el);
    return () => ro.disconnect();
  }, []);

  return (
    <div ref={ref} className="h-screen w-screen">
      {size.width > 0 && (
        <TreeChart
          width={size.width}
          height={size.height}
          layout={s.layout}
          orientation={s.orientation}
          linkType={s.linkType}
          stepPercent={s.stepPercent}
        />
      )}
    </div>
  );
}

Dependencies

More by Airbnb

View all
  • Radar chart

    Radar chart

    104
  • Heatmaps

    Heatmaps

    101
  • Pie chart

    Pie chart

    99
  • Finance Chart

    Finance Chart

    83
  • Word cloud

    Word cloud

    62
  • Streamgraph

    Streamgraph

    50
  • Tooltip

    Tooltip

    49
  • Legends

    Legends

    44