WebberUI

Icon Cloud

可互動的 3D 標籤/圖示球雲,可拖曳旋轉並自動轉動。

以純 CSS 3D transform 把一組圖示均勻鋪在球面上,自動旋轉,並可用滑鼠或觸控拖曳操控,帶慣性收斂。

載入預覽⋯

Playground

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

320
40
1
<IconCloud />

安裝

npx shadcn@latest add https://webberui.com/r/icon-cloud.json

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

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

npm install motion lucide-react clsx tailwind-merge

使用

import { IconCloud } from "@/components/ui/icon-cloud";

<IconCloud size={300} iconSize={38} speed={1} />;

傳入自訂圖示節點以替換預設集合:

import { Github, Twitter, Figma } from "lucide-react";

<IconCloud
  icons={[
    <Github key="gh" width={40} height={40} />,
    <Twitter key="tw" width={40} height={40} />,
    <Figma key="fg" width={40} height={40} />,
  ]}
/>;

Props

Prop型別預設值說明
iconsReact.ReactNode[]內建 lucide 圖示集鋪在球面上的圖示節點
sizenumber320容器邊長(px)
iconSizenumber40每個圖示邊長(px)
speednumber1自動旋轉速度倍率,0 為停止
interactivebooleantrue是否可拖曳旋轉(僅指標裝置)
classNamestring透傳至容器

可及性

  • 使用者系統開啟「減少動態效果」時,球體定格於初始傾角、停止自動旋轉與拖曳
  • 圖示皆為裝飾性內容,對輔助科技隱藏(aria-hidden

On this page