Airbnb

Drag And Draw

Text 32

About

Here is beautiful drawing with drag component

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

Code

How Drag And Draw 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/drag-and-draw";
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);
  }, []);

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

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

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

export { DemoOne };

Dependencies

More by Airbnb

View all
  • Heatmaps

    Heatmaps

    127
  • Radar chart

    Radar chart

    126
  • Pie chart

    Pie chart

    107
  • Linktypes

    Linktypes

    101
  • Finance Chart

    Finance Chart

    93
  • Word cloud

    Word cloud

    73
  • Legends

    Legends

    64
  • Streamgraph

    Streamgraph

    57

More in Text

View all
  • Vertical Cut Reveal Characters

    Vertical Cut Reveal Characters

    134
  • Blur Reveal

    Blur Reveal

    395
  • Reveal Text

    Reveal Text

    165
  • Scroll Fill Headline

    Scroll Fill Headline

    66
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    14
  • Text Reveal

    Text Reveal

    405
  • Motion Blur Text

    Motion Blur Text

    48
  • Liquid Text

    Liquid Text

    277