全部 kit / 介面元件
bio-kit
Linktree/Beacons 式 link-in-bio React 元件組(carousel/可展開/產品/評論/影片/成就卡),shadcn 式、需 Tailwind
版本 v0.1.0 · 更新 2026-11-13
安裝
複製 src/(shadcn 式;peer: react, Tailwind)
說明
Linktree / Beacons 式的 link-in-bio React 元件組。carousel、可展開 bio、產品卡、評論卡、影片卡、成就卡、社群認證、分隔線、社群 icon —— 全部純展示(presentational),只吃 props(資料物件 + callback),零 Supabase、零後端、零 tenant 綁定。
從 CourseBloom 的講師個人頁抽出來、去耦後的獨立版本。給你做「創作者個人頁 / 講師頁 / 團隊介紹頁 / 產品連結頁」的現成積木。
這是什麼
一組 TypeScript + React 元件,走 shadcn 式 分發:不發 npm 套件、不做 build,直接把 src/ 複製進你的專案,之後想改就改,程式碼是你的。
| 元件 | 用途 |
|---|---|
BioPageWide | 主頁面:滿版 hero + 頭貼 + 社群 icon + 雙欄佈局,用 contentOrder 決定內容順序 |
BioCarousel | 圖片輪播(箭頭 + 圓點導覽,純 useState) |
ExpandableBio | 可「顯示更多 / 收起」的自我介紹 |
ExpandableTextBlock | 可折疊的自訂文字區塊(對齊、顏色、邊框) |
BioReviewCard | 評論卡,支援 carousel / grid / list 三種顯示 |
BioVideoCard | YouTube / Vimeo 內嵌影片卡(附 BioVideoPreview 縮圖版) |
BioAchievementCard | 數據統計 + 稱號徽章卡 |
BioImage | 迷你 <img> 包裝(取代原本的 next/image,跨框架可用) |
Peer dependencies
複製進來之後,你的專案要裝:
npm install react lucide-react
# embla-carousel-react 為選用(見下方說明)
npm install embla-carousel-react
- react
>=18— 必要。 - lucide-react
>=0.300— 必要,元件用到的 icon(User / Instagram / Star / ChevronLeft…)。 - embla-carousel-react
>=8— 選用。列在 peer deps 是為了讓你之後想把BioCarousel換成 embla 版更順手;目前內建的BioCarousel是輕量useState實作,並沒有 import embla,所以不裝也能跑。 - Tailwind CSS — 這些元件用 Tailwind utility class 排版(
bg-white、rounded-2xl、aspect-video…)。你的專案需要有 Tailwind,否則樣式不會生效。沒有依賴 shadcn/ui 的任何 primitive(原始碼裡用到的next/image已被BioImage這個純<img>版取代),所以不需要另外安裝 shadcn。
註:
ExpandableBio用到line-clamp-{n}動態 class。若你的 Tailwind 會 purge,記得在safelist補上line-clamp-3/line-clamp-4,或改用固定值。
shadcn 式用法(複製貼上)
- 把本 repo 的
src/複製到你的專案,例如components/bio/。 - 確認上面的 peer deps 有裝、Tailwind 有設定好。
- 直接 import 使用:
import { BioPageWide } from "@/components/bio";
沒有 build step、沒有發套件 —— 程式碼進你的 repo 後就是你的,隨意改。
範例:BioPageWide
BioPageWide 是最主要的容器。它本身不抓資料,你把資料組好、用 contentOrder 決定右欄內容的排列順序丟進去即可。
import { BioPageWide } from "@/components/bio";
export default function CreatorPage() {
return (
<BioPageWide
instructorName="王小明"
avatarUrl="https://example.com/avatar.jpg"
bio={"我是一位獨立講師,\n專注在前端與設計。"}
// 舊式:沒給 contentOrder 時,直接把 bioLinks 排成按鈕
bioLinks={[
{ id: "l1", title: "我的官網", url: "https://example.com" },
{ id: "l2", title: "訂閱電子報", url: "https://example.com/news" },
]}
socialLinks={{
instagram: "https://instagram.com/xxx",
instagram_followers: "12.5k",
youtube: "https://youtube.com/@xxx",
youtube_followers: "3200",
email: "hi@example.com",
website: "https://example.com",
}}
expertiseEnabled
expertiseTags={["前端", "設計系統", "教學"]}
carouselItems={[
{ id: "c1", imageUrl: "https://example.com/1.jpg" },
{ id: "c2", imageUrl: "https://example.com/2.jpg" },
]}
productCards={[
{
id: "p1",
imageUrl: "https://example.com/course.jpg",
name: "React 實戰課",
price: 1980,
originalPrice: 2980,
buttonText: "立即報名",
buttonUrl: "https://example.com/buy",
},
]}
bioDividers={[{ id: "d1", style: "wave", color: "#14b8a6" }]}
bioTextBlocks={[
{
id: "t1",
content: "限時優惠,本週結束。",
align: "center",
textColor: "#111827",
collapsed: false,
borderColor: "#e5e7eb",
hasBorder: true,
},
]}
bioVideos={[{ id: "v1", url: "https://youtu.be/dQw4w9WgXcQ", title: "課程介紹" }]}
reviews={[
{
id: "r1",
rating: 5,
content: "受益良多,講得非常清楚!",
userName: "阿華",
courseName: "React 實戰課",
createdAt: "2026-01-01",
},
]}
bioReviewSettings={{
enabled: true,
displayMode: "carousel",
maxDisplay: 5,
source: "manual",
showCourseTitle: true,
showAvatar: true,
}}
// contentOrder 決定右欄由上到下的內容順序
contentOrder={[
{ type: "verification" },
{ type: "carousel" },
{ type: "product", id: "p1" },
{ type: "divider", id: "d1" },
{ type: "textblock", id: "t1" },
{ type: "video", id: "v1" },
{ type: "review" },
]}
// 外觀
bgType="gradient" // "gradient" | "color" | "image"
bgGradient="from-teal-400 to-blue-500"
bgColor="#f5f5f5"
backgroundImage=""
buttonStyle="filled" // "filled" | "outline" | 其他 = soft
textColor="#111827"
/>
);
}
contentOrder 支援的 type
carousel · verification(社群認證/總粉絲數)· product · divider · textblock · link · review · video · achievement。
帶 id 的(product / divider / textblock / link / video)會去對應的陣列(productCards / bioDividers / …)找那筆資料。不帶 id 的(verification / carousel / review / achievement)走各自的設定。
授權
MIT © Jeffrey0117