Airbnb

Brush

Component 18

About

Brush component

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

Code

How Brush 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/brush';
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>
    );
  }

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

export { DemoOne };

Dependencies

More by Airbnb

View all
  • Radar chart

    Radar chart

    103
  • Heatmaps

    Heatmaps

    101
  • Pie chart

    Pie chart

    99
  • Linktypes

    Linktypes

    94
  • Finance Chart

    Finance Chart

    83
  • Word cloud

    Word cloud

    62
  • Streamgraph

    Streamgraph

    50
  • Tooltip

    Tooltip

    49