Airbnb

Voronoi

Backgrounds 10

About

a interactive voronoi

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

Code

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

Usage.tsx

// DemoOne.tsx
import React, { useState, useEffect } from "react";
import { Component } from "@/components/ui/voronoi";
import { cn } from "@/lib/utils";

const DemoOne = () => {
  const [dimensions, setDimensions] = useState({ width: 0, height: 0 });

  useEffect(() => {
    const updateDimensions = () => {
      setDimensions({
        width: window.innerWidth,
        height: window.innerHeight,
      });
    };

    updateDimensions();
    window.addEventListener("resize", updateDimensions);
    return () => window.removeEventListener("resize", updateDimensions);
  }, []);

  const chartWidth = dimensions.width;
  const chartHeight = dimensions.height;

  if (chartWidth === 0 || chartHeight === 0) {
    return (
      <div className={cn("flex w-screen h-screen justify-center items-center bg-gray-900 text-white")}>
        Загрузка...
      </div>
    );
  }

  const displayWidth = chartWidth * 0.9;
  const displayHeight = chartHeight * 0.9;

  return (
    <div className={cn("w-screen h-screen overflow-hidden bg-gray-800 flex justify-center items-center")}>
      <Component
        width={displayWidth}
        height={displayHeight}
      />
    </div>
  );
};

export { DemoOne };

Dependencies

More by Airbnb

View all
  • Radar chart

    Radar chart

    109
  • Heatmaps

    Heatmaps

    107
  • Pie chart

    Pie chart

    100
  • Linktypes

    Linktypes

    96
  • Finance Chart

    Finance Chart

    85
  • Word cloud

    Word cloud

    63
  • Streamgraph

    Streamgraph

    51
  • Tooltip

    Tooltip

    49

More in Backgrounds

View all
  • Elegant Dark Pattern

    Elegant Dark Pattern

    846
  • Gradient Backgrounds

    Gradient Backgrounds

    26
  • Tailwind CSS Background Snippet

    Tailwind CSS Background Snippet

    552
  • Background snippets

    Background snippets

    18
  • LivingOrigami bg

    LivingOrigami bg

    144
  • Gradient Blur Bg

    Gradient Blur Bg

    28
  • Background Components

    Background Components

    45
  • Light theme Tailwind CSS Background Snippet

    Light theme Tailwind CSS Background Snippet

    229