WebberUI

Chroma Grid

灰階卡片網格,游標經過時以聚光燈局部顯色。

一組預設灰階的卡片網格,游標移動時像手電筒一樣照亮周圍,讓經過的卡片顯露全彩,離開即淡回灰階。

載入預覽⋯

Playground

即時調整 props、程式碼片段同步更新——直接試出你要的樣子再複製。

3
260
160
<ChromaGrid />

安裝

npx shadcn@latest add https://webberui.com/r/chroma-grid.json

或在 components.json 設定 registries 後,改用 @webberui/chroma-grid 安裝。

安裝依賴後,從 registry JSON(/r/chroma-grid.jsonfiles[0].content)複製 chroma-grid.tsx 原始碼到你的 components/ui/ 目錄:

npm install motion clsx tailwind-merge

使用

import { ChromaGrid, type ChromaGridItem } from "@/components/ui/chroma-grid";

const items: ChromaGridItem[] = [
  {
    title: "Aurora",
    subtitle: "Product Designer",
    gradient: "linear-gradient(150deg, #22d3ee, #0e7490)",
    glowColor: "#22d3ee",
  },
  // ...
];

<ChromaGrid items={items} columns={3} radius={240} />

Props

ChromaGrid

Prop型別預設值說明
itemsChromaGridItem[]卡片資料
columnsnumber3網格欄數
radiusnumber260顯色聚光燈半徑(px)
cardHeightnumber260單張卡片高度(px)
classNamestring附加到最外層容器的 class

ChromaGridItem

欄位型別預設值說明
titlestring卡片主標題
subtitlestring次要說明文字
handlestring右下角小標籤
gradientstringlinear-gradient(...)卡片漸層底色,任何合法 CSS background
glowColorstring#6366f1邊框與光暈顏色

可及性

  • 使用者系統開啟「減少動態效果」時,直接呈現全彩靜態網格,不追蹤游標、不做灰階
  • 顯色層與聚光燈皆為 aria-hidden 純裝飾,底層卡片文字維持可讀

On this page