组件 热图 热图组件

热图组件

具有响应式效果和深色主题支持的热图组件。

预览

HTML 代码

<div class="bg-gray-900 text-white p-8">
  <h2 class="text-2xl font-bold mb-4">Heat Map</h2>
  <div class="grid grid-cols-7 gap-1">
    <!-- Days of the week -->
    <div class="text-center text-sm text-gray-400">Sun</div>
    <div class="text-center text-sm text-gray-400">Mon</div>
    <div class="text-center text-sm text-gray-400">Tue</div>
    <div class="text-center text-sm text-gray-400">Wed</div>
    <div class="text-center text-sm text-gray-400">Thu</div>
    <div class="text-center text-sm text-gray-400">Fri</div>
    <div class="text-center text-sm text-gray-400">Sat</div>

    <!-- Heat map squares (example data) -->
    {[...Array(42)].map((_, i) => (
      `<div key=${i} class="h-8 bg-gray-700 rounded heat-square data-level-{{
        (
          () => {
            const random = Math.random();
            if (random < 0.4) return 1; /* low activity */
            if (random < 0.7) return 2; /* medium activity */
            if (random < 0.9) return 3; /* high activity */
            return 4; /* very high activity */
          }
        )()
      }}"></div>`
    )).join("")}
  </div>

  <style>
    .heat-square[data-level="1"] {
      background-color: #1e3a8a; /* blue-900 */
    }
    .heat-square[data-level="2"] {
      background-color: #1d4ed8; /* blue-700 */
    }
    .heat-square[data-level="3"] {
      background-color: #3b82f6; /* blue-500 */
    }
    .heat-square[data-level="4"] {
      background-color: #60a5fa; /* blue-400 */
    }

    /* Responsive adjustments */
    @media (max-width: 768px) {
      .grid-cols-7 {
        grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
      }
      .heat-square {
        height: 40px;
      }
    }
  </style>
</div>

相关组件

神经拟态生动热图组件

一个响应式热力图组件,采用Neumorphism设计,使用鲜艳的颜色方案和适度的复杂性。包含黑暗模式支持和悬停效果。使用简单的HTML和Tailwind CSS类构建,附加一个小的CSS块以实现自定义的Neumorphism阴影和颜色等级。

打开

热力图组件

一个响应式热图组件,使用 Tailwind CSS 样式,具有微交互和深色主题支持,使用占位符图像和头像。

打开

热力图组件

一个采⽤玻璃形变风格设计的热图组件,以大地色为主。布局简单,由基本元素组成,适合商业/企业用途,并支持深色模式。

打开