Airbnb

Glyphs

Component 2

About

Glyphs component

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

Code

How Glyphs 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, secondaryColor } from "@/components/ui/glyphs";
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 flex justify-center items-center")} style={{ backgroundColor: secondaryColor }}>
      <Component
        width={displayWidth}
        height={displayHeight}
      />
    </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