WebberUI

行事曆議程視圖

月曆與當日議程聯動的行事曆面板,事件色籤。

左側月曆網格顯示整月天數,有事件的日期以色點標記,選中圓圈透過 layoutId 在日期間平滑移動;右側議程時間軸以 AnimatePresence 切換當日事件卡,適合儀表板或應用面板中的排程總覽。

載入預覽⋯

Playground

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

2026
7
15
<CalendarAgendaView />

安裝

npx shadcn@latest add https://webberui.com/r/calendar-agenda-view.json

或在 components.json 設定 registries 後,改用 @webberui/calendar-agenda-view 安裝。

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

npm install motion lucide-react clsx tailwind-merge

使用

import {
  CalendarAgendaView,
  type AgendaEvent,
} from "@/components/ui/calendar-agenda-view";

const events: AgendaEvent[] = [
  {
    id: "e1",
    day: 16,
    start: "09:30",
    end: "10:30",
    title: "產品週會",
    location: "會議室 A",
    attendees: 8,
    color: "sky",
  },
];

<CalendarAgendaView
  year={2026}
  month={7}
  events={events}
  defaultSelectedDay={16}
/>

Props

Prop型別預設值說明
yearnumber2026顯示的年份(固定值以確保 SSR 與客戶端一致)
monthnumber7顯示的月份,1–12
eventsAgendaEvent[][]事件清單,依 day 分組後自動按開始時間排序
defaultSelectedDaynumber1初始選中的日(1 起算)
classNamestring透傳到最外層卡片容器

AgendaEvent

欄位型別預設值說明
idstring事件唯一識別碼
daynumber事件位於該月份的第幾天(1 起算)
startstring開始時間,24 小時制字串,例如 "09:30"
endstring結束時間,24 小時制字串,例如 "10:30"
titlestring事件標題
locationstring地點或補充說明(可選)
attendeesnumber參與人數(可選),有值時顯示人數徽章
color"sky" | "violet" | "emerald" | "amber" | "rose""sky"色籤,決定日曆圓點與議程卡色條的顏色

可及性

  • 每個日期格皆為原生 button,以 aria-pressed 標記選中狀態,aria-label 完整朗讀日期與當日行程數
  • 日期格支援鍵盤 Tab 導覽與 focus-visible 焦點環
  • 使用者系統開啟「減少動態效果」時,選中圓圈位移與議程切換動畫改為即時完成
  • 事件色籤僅作輔助標記,時間、標題、地點皆以文字呈現,不依賴顏色傳達資訊

On this page