網站導覽

v2.1.0
資料顯示

日程表

將事件依時間排列:單日或一週以垂直時間軸呈現各時段,一個月以各週的事件列呈現,或以議程清單呈現。

本頁內容

日程表沿著垂直時間軸排列一天的時段,每個事件的高度對應其持續時間。可用於行事曆的單日檢視、研討會各會議室的議程,或診所的預約。事件以有序清單呈現,每項都用文字標示標題和時間。樣式表依小時刻度配置事件,每個整點都有一條細線和一個標籤。時間重疊的事件會並排顯示。整個版面配置不使用腳本,也不量測任何尺寸。

持續一整天或連續多個整天的事件會放在時段上方的橫帶中。月檢視將每天的事件排成多列,議程則依日期列出事件。日程檢視是讀者實際操作的日程表,可依日、週、月或議程切換,由 schedule 行為驅動。

日程表

<div class="card max-w(480) mx-auto">  <div class="schedule schedule-now" style="--schedule-from: 9; --schedule-to: 15; --now: 12.45">    <ol class="schedule-rail" aria-hidden="true">      <li>9 AM</li>      <li>10 AM</li>      <li>11 AM</li>      <li>12 PM</li>      <li>1 PM</li>      <li>2 PM</li>      <li>3 PM</li>    </ol>    <ol class="schedule-events" aria-label="Thursday 13 November">      <li class="schedule-event" style="--start: 9; --end: 9.5">        <p class="schedule-title">Standup</p>        <p class="schedule-time">          <time datetime="09:00">9:00</time> – <time datetime="09:30">9:30</time>        </p>      </li>      <li class="schedule-event" style="--start: 10; --end: 11.5; --lanes: 2">        <p class="schedule-title">Design review</p>        <p class="schedule-time">          <time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time>        </p>      </li>      <li class="schedule-event" style="--start: 10.5; --end: 12; --lane: 1; --lanes: 2">        <p class="schedule-title">Interview: platform engineer</p>        <p class="schedule-time">          <time datetime="10:30">10:30</time> – <time datetime="12:00">12:00</time>        </p>      </li>      <li class="schedule-event" style="--start: 12; --end: 12.25">        <p class="schedule-title">Check-in with Alan</p>        <p class="schedule-time">          <time datetime="12:00">12:00</time> – <time datetime="12:15">12:15</time>        </p>      </li>      <li class="schedule-event" style="--start: 12.75; --end: 13.75">        <p class="schedule-title">Lunch with Ada</p>        <p class="schedule-time">          <time datetime="12:45">12:45</time> – <time datetime="13:45">13:45</time>        </p>      </li>      <li class="schedule-event" style="--start: 14; --end: 14.5">        <p class="schedule-title">1:1 with Grace</p>        <p class="schedule-time">          <time datetime="14:00">14:00</time> – <time datetime="14:30">14:30</time>        </p>      </li>    </ol>  </div></div>
<div className="card max-w(480) mx-auto">  <div className="schedule schedule-now" style={{ '--schedule-from': '9', '--schedule-to': '15', '--now': '12.45' } as React.CSSProperties}>    <ol className="schedule-rail" aria-hidden="true">      <li>9 AM</li>      <li>10 AM</li>      <li>11 AM</li>      <li>12 PM</li>      <li>1 PM</li>      <li>2 PM</li>      <li>3 PM</li>    </ol>    <ol className="schedule-events" aria-label="Thursday 13 November">      <li className="schedule-event" style={{ '--start': '9', '--end': '9.5' } as React.CSSProperties}>        <p className="schedule-title">Standup</p>        <p className="schedule-time">          <time dateTime="09:00">9:00</time> – <time dateTime="09:30">9:30</time>        </p>      </li>      <li className="schedule-event" style={{ '--start': '10', '--end': '11.5', '--lanes': '2' } as React.CSSProperties}>        <p className="schedule-title">Design review</p>        <p className="schedule-time">          <time dateTime="10:00">10:00</time> – <time dateTime="11:30">11:30</time>        </p>      </li>      <li className="schedule-event" style={{ '--start': '10.5', '--end': '12', '--lane': '1', '--lanes': '2' } as React.CSSProperties}>        <p className="schedule-title">Interview: platform engineer</p>        <p className="schedule-time">          <time dateTime="10:30">10:30</time> – <time dateTime="12:00">12:00</time>        </p>      </li>      <li className="schedule-event" style={{ '--start': '12', '--end': '12.25' } as React.CSSProperties}>        <p className="schedule-title">Check-in with Alan</p>        <p className="schedule-time">          <time dateTime="12:00">12:00</time> – <time dateTime="12:15">12:15</time>        </p>      </li>      <li className="schedule-event" style={{ '--start': '12.75', '--end': '13.75' } as React.CSSProperties}>        <p className="schedule-title">Lunch with Ada</p>        <p className="schedule-time">          <time dateTime="12:45">12:45</time> – <time dateTime="13:45">13:45</time>        </p>      </li>      <li className="schedule-event" style={{ '--start': '14', '--end': '14.5' } as React.CSSProperties}>        <p className="schedule-title">1:1 with Grace</p>        <p className="schedule-time">          <time dateTime="14:00">14:00</time> – <time dateTime="14:30">14:30</time>        </p>      </li>    </ol>  </div></div>
<div class="card max-w(480) mx-auto">  <div class="schedule schedule-now" style="--schedule-from: 9; --schedule-to: 15; --now: 12.45">    <ol class="schedule-rail" aria-hidden="true">      <li>9 AM</li>      <li>10 AM</li>      <li>11 AM</li>      <li>12 PM</li>      <li>1 PM</li>      <li>2 PM</li>      <li>3 PM</li>    </ol>    <ol class="schedule-events" aria-label="Thursday 13 November">      <li class="schedule-event" style="--start: 9; --end: 9.5">        <p class="schedule-title">Standup</p>        <p class="schedule-time">          <time datetime="09:00">9:00</time> – <time datetime="09:30">9:30</time>        </p>      </li>      <li class="schedule-event" style="--start: 10; --end: 11.5; --lanes: 2">        <p class="schedule-title">Design review</p>        <p class="schedule-time">          <time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time>        </p>      </li>      <li class="schedule-event" style="--start: 10.5; --end: 12; --lane: 1; --lanes: 2">        <p class="schedule-title">Interview: platform engineer</p>        <p class="schedule-time">          <time datetime="10:30">10:30</time> – <time datetime="12:00">12:00</time>        </p>      </li>      <li class="schedule-event" style="--start: 12; --end: 12.25">        <p class="schedule-title">Check-in with Alan</p>        <p class="schedule-time">          <time datetime="12:00">12:00</time> – <time datetime="12:15">12:15</time>        </p>      </li>      <li class="schedule-event" style="--start: 12.75; --end: 13.75">        <p class="schedule-title">Lunch with Ada</p>        <p class="schedule-time">          <time datetime="12:45">12:45</time> – <time datetime="13:45">13:45</time>        </p>      </li>      <li class="schedule-event" style="--start: 14; --end: 14.5">        <p class="schedule-title">1:1 with Grace</p>        <p class="schedule-time">          <time datetime="14:00">14:00</time> – <time datetime="14:30">14:30</time>        </p>      </li>    </ol>  </div></div>
<template>  <div class="card max-w(480) mx-auto">    <div class="schedule schedule-now" style="--schedule-from: 9; --schedule-to: 15; --now: 12.45">      <ol class="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>        <li>1 PM</li>        <li>2 PM</li>        <li>3 PM</li>      </ol>      <ol class="schedule-events" aria-label="Thursday 13 November">        <li class="schedule-event" style="--start: 9; --end: 9.5">          <p class="schedule-title">Standup</p>          <p class="schedule-time">            <time datetime="09:00">9:00</time> – <time datetime="09:30">9:30</time>          </p>        </li>        <li class="schedule-event" style="--start: 10; --end: 11.5; --lanes: 2">          <p class="schedule-title">Design review</p>          <p class="schedule-time">            <time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time>          </p>        </li>        <li class="schedule-event" style="--start: 10.5; --end: 12; --lane: 1; --lanes: 2">          <p class="schedule-title">Interview: platform engineer</p>          <p class="schedule-time">            <time datetime="10:30">10:30</time> – <time datetime="12:00">12:00</time>          </p>        </li>        <li class="schedule-event" style="--start: 12; --end: 12.25">          <p class="schedule-title">Check-in with Alan</p>          <p class="schedule-time">            <time datetime="12:00">12:00</time> – <time datetime="12:15">12:15</time>          </p>        </li>        <li class="schedule-event" style="--start: 12.75; --end: 13.75">          <p class="schedule-title">Lunch with Ada</p>          <p class="schedule-time">            <time datetime="12:45">12:45</time> – <time datetime="13:45">13:45</time>          </p>        </li>        <li class="schedule-event" style="--start: 14; --end: 14.5">          <p class="schedule-title">1:1 with Grace</p>          <p class="schedule-time">            <time datetime="14:00">14:00</time> – <time datetime="14:30">14:30</time>          </p>        </li>      </ol>    </div>  </div></template>

#事件的定位方式

時間刻度從 --schedule-from 到 --schedule-to,兩者都在 schedule 上設定。每小時的高度由 --schedule-hour 指定,預設為 48px。每個 schedule-event 都以同一套小時刻度設定 --start 和 --end,例如上午十點半是 10.5,下午一點四十五分是 13.75。事件依指定時間開始和結束,上下各與細線留出 1px 的間距,因此前後相接的事件之間仍會保留一條線。

schedule-rail 包含從 --schedule-from 到 --schedule-to 的每個整點標籤,起訖整點都包含在內。每個標籤都垂直置中於對應的細線。請採用讀者慣用的時間格式。時間軸寬 48px(--schedule-rail)。

若每小時高 48px,一整天就會超過 1,100px。可只顯示需要的時段,或將日程表放進捲動區域,讓使用者捲動查看。

#時間重疊的事件

時間重疊的事件會共用可用寬度。為每個事件設定 --lanes,表示該處並排的事件數,再設定 --lane,表示它在這些事件中的位置,從 0 開始。上例中的設計審查和面試在同一段時間各占一欄。產生清單的程式碼依資料決定各事件所在的欄,樣式表只負責定位。

#短時間事件

每個事件都是尺寸容器,會透過容器查詢依自身高度調整文字版面配置。

  • 在預設尺寸下,持續一小時以上的事件會將標題放在時間上方。
  • 較短的事件會將標題和時間排在同一行,並在事件內垂直置中。如果一行放不下兩者,就會隱藏時間。
  • 如果連一行文字都放不下,例如預設尺寸下長度為 15 分鐘的事件,畫面上只會顯示帶底色的區塊。文字仍保留在清單中,供輔助技術讀取,事件在時間軸上的位置則表示其發生時間。

#目前時間與目前事件

在日程表上設定 schedule-now,就會在 --now 畫出一條深色線,並在線條與當日欄位起始邊緣的交點加上圓點。位置和事件一樣以小時為單位。線條從事件底下穿過,因此不會劃過事件文字。

以 aria-current="true" 標記的事件會使用深色底色,表示它正在進行,或其詳細資料已在日程表旁開啟。

#多日檢視

若要並排顯示多天,請將每天的 schedule-events 放進 schedule-day,並在上方加上 schedule-heading。各天平分可用寬度並共用時間軸,標題和小時刻度會彼此對齊。以 aria-current="date" 標記今天的欄位,讓標題使用較深的文字色。目前時間線會帶著圓點穿過今天的欄位,並以細線延伸至其他日期。

多日檢視

<div class="card max-w(560) mx-auto">  <div class="schedule schedule-now" style="--schedule-from: 9; --schedule-to: 13; --now: 11.25">    <ol class="schedule-rail" aria-hidden="true">      <li>9 AM</li>      <li>10 AM</li>      <li>11 AM</li>      <li>12 PM</li>      <li>1 PM</li>    </ol>    <section class="schedule-day" aria-labelledby="day-12">      <h3 class="schedule-heading" id="day-12">Wed 12</h3>      <ol class="schedule-events">        <li class="schedule-event" style="--start: 9; --end: 10">          <p class="schedule-title">Roadmap</p>          <p class="schedule-time">            <time datetime="09:00">9:00</time> – <time datetime="10:00">10:00</time>          </p>        </li>        <li class="schedule-event" style="--start: 11; --end: 12.5">          <p class="schedule-title">Workshop</p>          <p class="schedule-time">            <time datetime="11:00">11:00</time> – <time datetime="12:30">12:30</time>          </p>        </li>      </ol>    </section>    <section class="schedule-day" aria-current="date" aria-labelledby="day-13">      <h3 class="schedule-heading" id="day-13">Thu 13</h3>      <ol class="schedule-events">        <li class="schedule-event" style="--start: 9; --end: 9.5">          <p class="schedule-title">Standup</p>          <p class="schedule-time">            <time datetime="09:00">9:00</time> – <time datetime="09:30">9:30</time>          </p>        </li>        <li class="schedule-event" style="--start: 10; --end: 11.5; --lanes: 2">          <p class="schedule-title">Design review</p>          <p class="schedule-time">            <time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time>          </p>        </li>        <li class="schedule-event" aria-current="true" style="--start: 10.5; --end: 12; --lane: 1; --lanes: 2">          <p class="schedule-title">Interview</p>          <p class="schedule-time">            <time datetime="10:30">10:30</time> – <time datetime="12:00">12:00</time>          </p>        </li>        <li class="schedule-event" style="--start: 12.25; --end: 13">          <p class="schedule-title">Lunch</p>          <p class="schedule-time">            <time datetime="12:15">12:15</time> – <time datetime="13:00">13:00</time>          </p>        </li>      </ol>    </section>    <section class="schedule-day" aria-labelledby="day-14">      <h3 class="schedule-heading" id="day-14">Fri 14</h3>      <ol class="schedule-events">        <li class="schedule-event" style="--start: 9.5; --end: 10.25">          <p class="schedule-title">Sync</p>          <p class="schedule-time">            <time datetime="09:30">9:30</time> – <time datetime="10:15">10:15</time>          </p>        </li>        <li class="schedule-event" style="--start: 11.5; --end: 13">          <p class="schedule-title">Offsite</p>          <p class="schedule-time">            <time datetime="11:30">11:30</time> – <time datetime="13:00">13:00</time>          </p>        </li>      </ol>    </section>  </div></div>
<div className="card max-w(560) mx-auto">  <div className="schedule schedule-now" style={{ '--schedule-from': '9', '--schedule-to': '13', '--now': '11.25' } as React.CSSProperties}>    <ol className="schedule-rail" aria-hidden="true">      <li>9 AM</li>      <li>10 AM</li>      <li>11 AM</li>      <li>12 PM</li>      <li>1 PM</li>    </ol>    <section className="schedule-day" aria-labelledby="day-12">      <h3 className="schedule-heading" id="day-12">Wed 12</h3>      <ol className="schedule-events">        <li className="schedule-event" style={{ '--start': '9', '--end': '10' } as React.CSSProperties}>          <p className="schedule-title">Roadmap</p>          <p className="schedule-time">            <time dateTime="09:00">9:00</time> – <time dateTime="10:00">10:00</time>          </p>        </li>        <li className="schedule-event" style={{ '--start': '11', '--end': '12.5' } as React.CSSProperties}>          <p className="schedule-title">Workshop</p>          <p className="schedule-time">            <time dateTime="11:00">11:00</time> – <time dateTime="12:30">12:30</time>          </p>        </li>      </ol>    </section>    <section className="schedule-day" aria-current="date" aria-labelledby="day-13">      <h3 className="schedule-heading" id="day-13">Thu 13</h3>      <ol className="schedule-events">        <li className="schedule-event" style={{ '--start': '9', '--end': '9.5' } as React.CSSProperties}>          <p className="schedule-title">Standup</p>          <p className="schedule-time">            <time dateTime="09:00">9:00</time> – <time dateTime="09:30">9:30</time>          </p>        </li>        <li className="schedule-event" style={{ '--start': '10', '--end': '11.5', '--lanes': '2' } as React.CSSProperties}>          <p className="schedule-title">Design review</p>          <p className="schedule-time">            <time dateTime="10:00">10:00</time> – <time dateTime="11:30">11:30</time>          </p>        </li>        <li className="schedule-event" aria-current="true" style={{ '--start': '10.5', '--end': '12', '--lane': '1', '--lanes': '2' } as React.CSSProperties}>          <p className="schedule-title">Interview</p>          <p className="schedule-time">            <time dateTime="10:30">10:30</time> – <time dateTime="12:00">12:00</time>          </p>        </li>        <li className="schedule-event" style={{ '--start': '12.25', '--end': '13' } as React.CSSProperties}>          <p className="schedule-title">Lunch</p>          <p className="schedule-time">            <time dateTime="12:15">12:15</time> – <time dateTime="13:00">13:00</time>          </p>        </li>      </ol>    </section>    <section className="schedule-day" aria-labelledby="day-14">      <h3 className="schedule-heading" id="day-14">Fri 14</h3>      <ol className="schedule-events">        <li className="schedule-event" style={{ '--start': '9.5', '--end': '10.25' } as React.CSSProperties}>          <p className="schedule-title">Sync</p>          <p className="schedule-time">            <time dateTime="09:30">9:30</time> – <time dateTime="10:15">10:15</time>          </p>        </li>        <li className="schedule-event" style={{ '--start': '11.5', '--end': '13' } as React.CSSProperties}>          <p className="schedule-title">Offsite</p>          <p className="schedule-time">            <time dateTime="11:30">11:30</time> – <time dateTime="13:00">13:00</time>          </p>        </li>      </ol>    </section>  </div></div>
<div class="card max-w(560) mx-auto">  <div class="schedule schedule-now" style="--schedule-from: 9; --schedule-to: 13; --now: 11.25">    <ol class="schedule-rail" aria-hidden="true">      <li>9 AM</li>      <li>10 AM</li>      <li>11 AM</li>      <li>12 PM</li>      <li>1 PM</li>    </ol>    <section class="schedule-day" aria-labelledby="day-12">      <h3 class="schedule-heading" id="day-12">Wed 12</h3>      <ol class="schedule-events">        <li class="schedule-event" style="--start: 9; --end: 10">          <p class="schedule-title">Roadmap</p>          <p class="schedule-time">            <time datetime="09:00">9:00</time> – <time datetime="10:00">10:00</time>          </p>        </li>        <li class="schedule-event" style="--start: 11; --end: 12.5">          <p class="schedule-title">Workshop</p>          <p class="schedule-time">            <time datetime="11:00">11:00</time> – <time datetime="12:30">12:30</time>          </p>        </li>      </ol>    </section>    <section class="schedule-day" aria-current="date" aria-labelledby="day-13">      <h3 class="schedule-heading" id="day-13">Thu 13</h3>      <ol class="schedule-events">        <li class="schedule-event" style="--start: 9; --end: 9.5">          <p class="schedule-title">Standup</p>          <p class="schedule-time">            <time datetime="09:00">9:00</time> – <time datetime="09:30">9:30</time>          </p>        </li>        <li class="schedule-event" style="--start: 10; --end: 11.5; --lanes: 2">          <p class="schedule-title">Design review</p>          <p class="schedule-time">            <time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time>          </p>        </li>        <li class="schedule-event" aria-current="true" style="--start: 10.5; --end: 12; --lane: 1; --lanes: 2">          <p class="schedule-title">Interview</p>          <p class="schedule-time">            <time datetime="10:30">10:30</time> – <time datetime="12:00">12:00</time>          </p>        </li>        <li class="schedule-event" style="--start: 12.25; --end: 13">          <p class="schedule-title">Lunch</p>          <p class="schedule-time">            <time datetime="12:15">12:15</time> – <time datetime="13:00">13:00</time>          </p>        </li>      </ol>    </section>    <section class="schedule-day" aria-labelledby="day-14">      <h3 class="schedule-heading" id="day-14">Fri 14</h3>      <ol class="schedule-events">        <li class="schedule-event" style="--start: 9.5; --end: 10.25">          <p class="schedule-title">Sync</p>          <p class="schedule-time">            <time datetime="09:30">9:30</time> – <time datetime="10:15">10:15</time>          </p>        </li>        <li class="schedule-event" style="--start: 11.5; --end: 13">          <p class="schedule-title">Offsite</p>          <p class="schedule-time">            <time datetime="11:30">11:30</time> – <time datetime="13:00">13:00</time>          </p>        </li>      </ol>    </section>  </div></div>
<template>  <div class="card max-w(560) mx-auto">    <div class="schedule schedule-now" style="--schedule-from: 9; --schedule-to: 13; --now: 11.25">      <ol class="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>        <li>1 PM</li>      </ol>      <section class="schedule-day" aria-labelledby="day-12">        <h3 class="schedule-heading" id="day-12">Wed 12</h3>        <ol class="schedule-events">          <li class="schedule-event" style="--start: 9; --end: 10">            <p class="schedule-title">Roadmap</p>            <p class="schedule-time">              <time datetime="09:00">9:00</time> – <time datetime="10:00">10:00</time>            </p>          </li>          <li class="schedule-event" style="--start: 11; --end: 12.5">            <p class="schedule-title">Workshop</p>            <p class="schedule-time">              <time datetime="11:00">11:00</time> – <time datetime="12:30">12:30</time>            </p>          </li>        </ol>      </section>      <section class="schedule-day" aria-current="date" aria-labelledby="day-13">        <h3 class="schedule-heading" id="day-13">Thu 13</h3>        <ol class="schedule-events">          <li class="schedule-event" style="--start: 9; --end: 9.5">            <p class="schedule-title">Standup</p>            <p class="schedule-time">              <time datetime="09:00">9:00</time> – <time datetime="09:30">9:30</time>            </p>          </li>          <li class="schedule-event" style="--start: 10; --end: 11.5; --lanes: 2">            <p class="schedule-title">Design review</p>            <p class="schedule-time">              <time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time>            </p>          </li>          <li class="schedule-event" aria-current="true" style="--start: 10.5; --end: 12; --lane: 1; --lanes: 2">            <p class="schedule-title">Interview</p>            <p class="schedule-time">              <time datetime="10:30">10:30</time> – <time datetime="12:00">12:00</time>            </p>          </li>          <li class="schedule-event" style="--start: 12.25; --end: 13">            <p class="schedule-title">Lunch</p>            <p class="schedule-time">              <time datetime="12:15">12:15</time> – <time datetime="13:00">13:00</time>            </p>          </li>        </ol>      </section>      <section class="schedule-day" aria-labelledby="day-14">        <h3 class="schedule-heading" id="day-14">Fri 14</h3>        <ol class="schedule-events">          <li class="schedule-event" style="--start: 9.5; --end: 10.25">            <p class="schedule-title">Sync</p>            <p class="schedule-time">              <time datetime="09:30">9:30</time> – <time datetime="10:15">10:15</time>            </p>          </li>          <li class="schedule-event" style="--start: 11.5; --end: 13">            <p class="schedule-title">Offsite</p>            <p class="schedule-time">              <time datetime="11:30">11:30</time> – <time datetime="13:00">13:00</time>            </p>          </li>        </ol>      </section>    </div>  </div></template>

卡片適合顯示三到五天,顯示一整週則以整頁寬度較易閱讀。可用空間較窄時,各天仍保有原本的寬度比例,放不下的標題會以省略號截斷。

#可開啟詳細資料的事件

如果事件可開啟詳細資料,請將 schedule-event 從清單項目移到項目內的連結或按鈕上。定位方式相同,指標移入時底色會加深一階,使用鍵盤聚焦時則會顯示焦點外框。

<li>  <a class="schedule-event" href="/events/design-review" style="--start: 10; --end: 11.5">    <span class="schedule-title">Design review</span>    <span class="schedule-time"><time datetime="10:00">10:00</time> – <time datetime="11:30">11:30</time></span>  </a></li>

#全天事件

持續一天以上的事件放在 schedule-allday 中,這條橫帶位於標題下方、時段上方,並在時間軸那一欄顯示它的名稱,例如「全天」。其中每個事件都是 schedule-event-lane:從第 --column 天開始,橫跨 --span 天,位於第 --lane 列。橫帶橫跨所有日期,因此每個 schedule-day 都要以 --column 標明自己是第幾欄,日程表則以 --schedule-days 說明共有幾欄。

全天事件

<div class="card max-w(560) mx-auto">  <div class="card-body">    <div class="schedule" style="--schedule-from: 9; --schedule-to: 13; --schedule-days: 3">      <ol class="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>        <li>1 PM</li>      </ol>      <div class="schedule-day" style="--column: 1">        <h3 class="schedule-heading">Wed 12</h3>        <ol class="schedule-events" aria-label="Wednesday 12 November">          <li class="schedule-event" style="--start: 9.5; --end: 10.5">            <p class="schedule-title">Planning</p>            <p class="schedule-time">9:30 – 10:30</p>          </li>        </ol>      </div>      <div class="schedule-day" style="--column: 2" aria-current="date">        <h3 class="schedule-heading">Thu 13</h3>        <ol class="schedule-events" aria-label="Thursday 13 November">          <li class="schedule-event" style="--start: 11; --end: 12">            <p class="schedule-title">Design review</p>            <p class="schedule-time">11:00 – 12:00</p>          </li>        </ol>      </div>      <div class="schedule-day" style="--column: 3">        <h3 class="schedule-heading">Fri 14</h3>        <ol class="schedule-events" aria-label="Friday 14 November"></ol>      </div>      <div class="schedule-allday" role="group" aria-label="All day">        <span class="schedule-allday-label" aria-hidden="true">All day</span>        <p class="schedule-event schedule-event-lane" style="--column: 2; --span: 2">          <span class="schedule-title">Offsite in Lisbon</span>        </p>        <p class="schedule-event schedule-event-lane schedule-event-continued" style="--column: 1; --lane: 1">          <span class="schedule-title">On call</span>        </p>      </div>    </div>  </div></div>
<div className="card max-w(560) mx-auto">  <div className="card-body">    <div className="schedule" style={{ '--schedule-from': '9', '--schedule-to': '13', '--schedule-days': '3' } as React.CSSProperties}>      <ol className="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>        <li>1 PM</li>      </ol>      <div className="schedule-day" style={{ '--column': '1' } as React.CSSProperties}>        <h3 className="schedule-heading">Wed 12</h3>        <ol className="schedule-events" aria-label="Wednesday 12 November">          <li className="schedule-event" style={{ '--start': '9.5', '--end': '10.5' } as React.CSSProperties}>            <p className="schedule-title">Planning</p>            <p className="schedule-time">9:30 – 10:30</p>          </li>        </ol>      </div>      <div className="schedule-day" style={{ '--column': '2' } as React.CSSProperties} aria-current="date">        <h3 className="schedule-heading">Thu 13</h3>        <ol className="schedule-events" aria-label="Thursday 13 November">          <li className="schedule-event" style={{ '--start': '11', '--end': '12' } as React.CSSProperties}>            <p className="schedule-title">Design review</p>            <p className="schedule-time">11:00 – 12:00</p>          </li>        </ol>      </div>      <div className="schedule-day" style={{ '--column': '3' } as React.CSSProperties}>        <h3 className="schedule-heading">Fri 14</h3>        <ol className="schedule-events" aria-label="Friday 14 November"></ol>      </div>      <div className="schedule-allday" role="group" aria-label="All day">        <span className="schedule-allday-label" aria-hidden="true">All day</span>        <p className="schedule-event schedule-event-lane" style={{ '--column': '2', '--span': '2' } as React.CSSProperties}>          <span className="schedule-title">Offsite in Lisbon</span>        </p>        <p className="schedule-event schedule-event-lane schedule-event-continued" style={{ '--column': '1', '--lane': '1' } as React.CSSProperties}>          <span className="schedule-title">On call</span>        </p>      </div>    </div>  </div></div>
<div class="card max-w(560) mx-auto">  <div class="card-body">    <div class="schedule" style="--schedule-from: 9; --schedule-to: 13; --schedule-days: 3">      <ol class="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>        <li>1 PM</li>      </ol>      <div class="schedule-day" style="--column: 1">        <h3 class="schedule-heading">Wed 12</h3>        <ol class="schedule-events" aria-label="Wednesday 12 November">          <li class="schedule-event" style="--start: 9.5; --end: 10.5">            <p class="schedule-title">Planning</p>            <p class="schedule-time">9:30 – 10:30</p>          </li>        </ol>      </div>      <div class="schedule-day" style="--column: 2" aria-current="date">        <h3 class="schedule-heading">Thu 13</h3>        <ol class="schedule-events" aria-label="Thursday 13 November">          <li class="schedule-event" style="--start: 11; --end: 12">            <p class="schedule-title">Design review</p>            <p class="schedule-time">11:00 – 12:00</p>          </li>        </ol>      </div>      <div class="schedule-day" style="--column: 3">        <h3 class="schedule-heading">Fri 14</h3>        <ol class="schedule-events" aria-label="Friday 14 November"></ol>      </div>      <div class="schedule-allday" role="group" aria-label="All day">        <span class="schedule-allday-label" aria-hidden="true">All day</span>        <p class="schedule-event schedule-event-lane" style="--column: 2; --span: 2">          <span class="schedule-title">Offsite in Lisbon</span>        </p>        <p class="schedule-event schedule-event-lane schedule-event-continued" style="--column: 1; --lane: 1">          <span class="schedule-title">On call</span>        </p>      </div>    </div>  </div></div>
<template>  <div class="card max-w(560) mx-auto">    <div class="card-body">      <div class="schedule" style="--schedule-from: 9; --schedule-to: 13; --schedule-days: 3">        <ol class="schedule-rail" aria-hidden="true">          <li>9 AM</li>          <li>10 AM</li>          <li>11 AM</li>          <li>12 PM</li>          <li>1 PM</li>        </ol>        <div class="schedule-day" style="--column: 1">          <h3 class="schedule-heading">Wed 12</h3>          <ol class="schedule-events" aria-label="Wednesday 12 November">            <li class="schedule-event" style="--start: 9.5; --end: 10.5">              <p class="schedule-title">Planning</p>              <p class="schedule-time">9:30 – 10:30</p>            </li>          </ol>        </div>        <div class="schedule-day" style="--column: 2" aria-current="date">          <h3 class="schedule-heading">Thu 13</h3>          <ol class="schedule-events" aria-label="Thursday 13 November">            <li class="schedule-event" style="--start: 11; --end: 12">              <p class="schedule-title">Design review</p>              <p class="schedule-time">11:00 – 12:00</p>            </li>          </ol>        </div>        <div class="schedule-day" style="--column: 3">          <h3 class="schedule-heading">Fri 14</h3>          <ol class="schedule-events" aria-label="Friday 14 November"></ol>        </div>        <div class="schedule-allday" role="group" aria-label="All day">          <span class="schedule-allday-label" aria-hidden="true">All day</span>          <p class="schedule-event schedule-event-lane" style="--column: 2; --span: 2">            <span class="schedule-title">Offsite in Lisbon</span>          </p>          <p class="schedule-event schedule-event-lane schedule-event-continued" style="--column: 1; --lane: 1">            <span class="schedule-title">On call</span>          </p>        </div>      </div>    </div>  </div></template>

在顯示範圍之前就已開始的事件片段使用 schedule-event-continued,延續到顯示範圍之後的片段則使用 schedule-event-continues:在橫列中,它的起點或終點會變成直角並延伸到邊緣;在時段中(跨越午夜時),則是頂端或底端。不是事件起點的片段不會顯示色條。

#分類色

schedule-event-category 會依事件本身或其外層所設定的分類色為事件上色:事件區塊使用分類的背景色,色條使用分類的標記色,文字使用分類的文字色。包含多個團隊或專案的行事曆可藉此區分它們;事件的內容仍由標題說明。

分類色

<div class="card max-w(480) mx-auto">  <div class="card-body">    <div class="schedule" style="--schedule-from: 9; --schedule-to: 12">      <ol class="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>      </ol>      <ol class="schedule-events" aria-label="Thursday 13 November">        <li class="schedule-event schedule-event-category category-violet" style="--start: 9; --end: 10; --lanes: 2">          <p class="schedule-title">User interviews</p>          <p class="schedule-time">9:00 – 10:00</p>        </li>        <li class="schedule-event schedule-event-category category-teal" style="--start: 9.5; --end: 11; --lane: 1; --lanes: 2">          <p class="schedule-title">Token audit</p>          <p class="schedule-time">9:30 – 11:00</p>        </li>        <li class="schedule-event schedule-event-category category-orange" style="--start: 11; --end: 11.75">          <p class="schedule-title">Launch check-in</p>          <p class="schedule-time">11:00 – 11:45</p>        </li>      </ol>    </div>  </div></div>
<div className="card max-w(480) mx-auto">  <div className="card-body">    <div className="schedule" style={{ '--schedule-from': '9', '--schedule-to': '12' } as React.CSSProperties}>      <ol className="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>      </ol>      <ol className="schedule-events" aria-label="Thursday 13 November">        <li className="schedule-event schedule-event-category category-violet" style={{ '--start': '9', '--end': '10', '--lanes': '2' } as React.CSSProperties}>          <p className="schedule-title">User interviews</p>          <p className="schedule-time">9:00 – 10:00</p>        </li>        <li className="schedule-event schedule-event-category category-teal" style={{ '--start': '9.5', '--end': '11', '--lane': '1', '--lanes': '2' } as React.CSSProperties}>          <p className="schedule-title">Token audit</p>          <p className="schedule-time">9:30 – 11:00</p>        </li>        <li className="schedule-event schedule-event-category category-orange" style={{ '--start': '11', '--end': '11.75' } as React.CSSProperties}>          <p className="schedule-title">Launch check-in</p>          <p className="schedule-time">11:00 – 11:45</p>        </li>      </ol>    </div>  </div></div>
<div class="card max-w(480) mx-auto">  <div class="card-body">    <div class="schedule" style="--schedule-from: 9; --schedule-to: 12">      <ol class="schedule-rail" aria-hidden="true">        <li>9 AM</li>        <li>10 AM</li>        <li>11 AM</li>        <li>12 PM</li>      </ol>      <ol class="schedule-events" aria-label="Thursday 13 November">        <li class="schedule-event schedule-event-category category-violet" style="--start: 9; --end: 10; --lanes: 2">          <p class="schedule-title">User interviews</p>          <p class="schedule-time">9:00 – 10:00</p>        </li>        <li class="schedule-event schedule-event-category category-teal" style="--start: 9.5; --end: 11; --lane: 1; --lanes: 2">          <p class="schedule-title">Token audit</p>          <p class="schedule-time">9:30 – 11:00</p>        </li>        <li class="schedule-event schedule-event-category category-orange" style="--start: 11; --end: 11.75">          <p class="schedule-title">Launch check-in</p>          <p class="schedule-time">11:00 – 11:45</p>        </li>      </ol>    </div>  </div></div>
<template>  <div class="card max-w(480) mx-auto">    <div class="card-body">      <div class="schedule" style="--schedule-from: 9; --schedule-to: 12">        <ol class="schedule-rail" aria-hidden="true">          <li>9 AM</li>          <li>10 AM</li>          <li>11 AM</li>          <li>12 PM</li>        </ol>        <ol class="schedule-events" aria-label="Thursday 13 November">          <li class="schedule-event schedule-event-category category-violet" style="--start: 9; --end: 10; --lanes: 2">            <p class="schedule-title">User interviews</p>            <p class="schedule-time">9:00 – 10:00</p>          </li>          <li class="schedule-event schedule-event-category category-teal" style="--start: 9.5; --end: 11; --lane: 1; --lanes: 2">            <p class="schedule-title">Token audit</p>            <p class="schedule-time">9:30 – 11:00</p>          </li>          <li class="schedule-event schedule-event-category category-orange" style="--start: 11; --end: 11.75">            <p class="schedule-title">Launch check-in</p>            <p class="schedule-time">11:00 – 11:45</p>          </li>        </ol>      </div>    </div>  </div></template>

#月檢視

schedule-month 將一個月呈現為數週、每週七天。每個 schedule-week 都按日期逐天輸出,每天依序放入日期、當天開始的事件,以及當天的「更多」按鈕,因此螢幕閱讀器會依日期順序讀到它們;樣式表則將它們放到各自的欄與列。日期數字 schedule-date-number 是可開啟該日的圓形按鈕,今天的按鈕會以深色填滿。每天顯示 --lanes 個事件(預設三個),其餘事件收進 schedule-more 按鈕,按下後會開啟列出這些事件的彈出面板。月檢視中的短事件使用不帶面板的簡潔樣式 schedule-event-plain:只有圓點、時間和標題。

可用空間窄於 36rem 時,事件列會退讓:每天只在日期數字下方為每個事件顯示一個圓點(最多三個),點按日期數字即可開啟當天。不會把文字硬塞進七個狹窄的欄位中。

schedule-agenda 依日期列出相同的事件:每列開頭是日期,旁邊是當天事件的 schedule-list;空間較窄時,事件會改放在日期下方。它適合手機、列印,以及偏好閱讀文字而非瀏覽圖面的讀者。

月檢視和議程是依事件資料寫出的,因此由行為或框架元件產生,如下方的檢視所示。

#日程檢視

schedule-view 在 schedule 行為所寫出的內容上方放一列控制項標頭:今天、上一個與下一個、期間名稱,以及切換日、週、月和議程的切換器。上一個與下一個依檢視的期間移動,點按日期數字會開啟該日,期間名稱改變時會被朗讀出來。空間較窄時,名稱會獨占一行。

日程檢視

<section class="schedule-view" id="team" aria-labelledby="team-title">  <div class="schedule-view-header">    <button type="button" class="btn btn-sm schedule-view-today">Today</button>    <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-previous" aria-label="Previous">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(180 8 8)" />      </svg>    </button>    <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-next" aria-label="Next">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" />      </svg>    </button>    <h2 class="schedule-view-title" id="team-title" aria-live="polite">November 2026</h2>    <div class="segmented segmented-sm schedule-view-switch" role="radiogroup" aria-label="View">      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="day">Day      </label>      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="week">Week      </label>      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="month" checked>Month      </label>      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="agenda">Agenda      </label>    </div>  </div>  <div class="schedule-view-body"></div></section><script>addEventListener('DOMContentLoaded', function () {MasterUI.schedule(document.getElementById('team'), {  today: '2026-11-13', locale: 'en-US', weekStart: 1, value: { date: '2026-11-13', view: 'month' },  events: [    { id: 'review', title: 'Design review', start: '2026-11-03T10:00', end: '2026-11-03T11:30', category: 'violet' },    { id: 'offsite', title: 'Offsite', start: '2026-11-07', end: '2026-11-11', allDay: true, category: 'teal' },    { id: 'deploy', title: 'Deploy window', start: '2026-11-12T22:00', end: '2026-11-13T02:00', category: 'red' },    { id: 'launch', title: 'Launch', start: '2026-11-13', end: '2026-11-14', allDay: true, category: 'orange' },    { id: 'standup', title: 'Standup', start: '2026-11-13T09:00', end: '2026-11-13T09:15' },    { id: 'lunch', title: 'Team lunch', start: '2026-11-13T12:00', end: '2026-11-13T13:00', category: 'green' },    { id: 'call', title: 'Customer call', start: '2026-11-13T14:00', end: '2026-11-13T15:00', category: 'blue' },    { id: 'retro', title: 'Retro', start: '2026-11-13T17:00', end: '2026-11-13T17:45' },    { id: 'planning', title: 'Planning', start: '2026-11-17T09:30', end: '2026-11-17T11:00', category: 'blue' },    { id: 'conference', title: 'Conference', start: '2026-11-19', end: '2026-11-22', allDay: true, category: 'violet' }  ]})})</script><script type="module">  import { attach } from '@master/ui/behaviors'  attach()</script>
import { useEffect, useRef } from 'react'import { attach, schedule } from '@master/ui/behaviors'import ChevronLeftIcon from '@master/icons-react/native/16/soft/chevron-left'import ChevronRightIcon from '@master/icons-react/native/16/soft/chevron-right'export function Example() {  const root = useRef<HTMLElement>(null)  useEffect(() => {    const detach = [      attach(root.current!),      schedule(document.getElementById('team')!, {        today: '2026-11-13', locale: 'en-US', weekStart: 1, value: { date: '2026-11-13', view: 'month' },        events: [          { id: 'review', title: 'Design review', start: '2026-11-03T10:00', end: '2026-11-03T11:30', category: 'violet' },          { id: 'offsite', title: 'Offsite', start: '2026-11-07', end: '2026-11-11', allDay: true, category: 'teal' },          { id: 'deploy', title: 'Deploy window', start: '2026-11-12T22:00', end: '2026-11-13T02:00', category: 'red' },          { id: 'launch', title: 'Launch', start: '2026-11-13', end: '2026-11-14', allDay: true, category: 'orange' },          { id: 'standup', title: 'Standup', start: '2026-11-13T09:00', end: '2026-11-13T09:15' },          { id: 'lunch', title: 'Team lunch', start: '2026-11-13T12:00', end: '2026-11-13T13:00', category: 'green' },          { id: 'call', title: 'Customer call', start: '2026-11-13T14:00', end: '2026-11-13T15:00', category: 'blue' },          { id: 'retro', title: 'Retro', start: '2026-11-13T17:00', end: '2026-11-13T17:45' },          { id: 'planning', title: 'Planning', start: '2026-11-17T09:30', end: '2026-11-17T11:00', category: 'blue' },          { id: 'conference', title: 'Conference', start: '2026-11-19', end: '2026-11-22', allDay: true, category: 'violet' }        ]      }),    ]    return () => detach.forEach(stop => stop())  }, [])  return (    <section ref={root} className="schedule-view" id="team" aria-labelledby="team-title">      <div className="schedule-view-header">        <button type="button" className="btn btn-sm schedule-view-today">Today</button>        <button type="button" className="btn btn-sm btn-square btn-quiet schedule-view-previous" aria-label="Previous">          <ChevronLeftIcon className="icon" />        </button>        <button type="button" className="btn btn-sm btn-square btn-quiet schedule-view-next" aria-label="Next">          <ChevronRightIcon className="icon" />        </button>        <h2 className="schedule-view-title" id="team-title" aria-live="polite">November 2026</h2>        <div className="segmented segmented-sm schedule-view-switch" role="radiogroup" aria-label="View">          <label className="segmented-item">            <input type="radio" className="segmented-input" name="team-view" value="day" />Day          </label>          <label className="segmented-item">            <input type="radio" className="segmented-input" name="team-view" value="week" />Week          </label>          <label className="segmented-item">            <input type="radio" className="segmented-input" name="team-view" value="month" defaultChecked />Month          </label>          <label className="segmented-item">            <input type="radio" className="segmented-input" name="team-view" value="agenda" />Agenda          </label>        </div>      </div>      <div className="schedule-view-body"></div>    </section>  )}
<script>  import { attach, schedule } from '@master/ui/behaviors'  import ChevronLeftIcon from '@master/icons-svelte/native/16/soft/chevron-left'  import ChevronRightIcon from '@master/icons-svelte/native/16/soft/chevron-right'  function mounted(root) {    const detach = [      attach(root),      schedule(document.getElementById('team'), {        today: '2026-11-13', locale: 'en-US', weekStart: 1, value: { date: '2026-11-13', view: 'month' },        events: [          { id: 'review', title: 'Design review', start: '2026-11-03T10:00', end: '2026-11-03T11:30', category: 'violet' },          { id: 'offsite', title: 'Offsite', start: '2026-11-07', end: '2026-11-11', allDay: true, category: 'teal' },          { id: 'deploy', title: 'Deploy window', start: '2026-11-12T22:00', end: '2026-11-13T02:00', category: 'red' },          { id: 'launch', title: 'Launch', start: '2026-11-13', end: '2026-11-14', allDay: true, category: 'orange' },          { id: 'standup', title: 'Standup', start: '2026-11-13T09:00', end: '2026-11-13T09:15' },          { id: 'lunch', title: 'Team lunch', start: '2026-11-13T12:00', end: '2026-11-13T13:00', category: 'green' },          { id: 'call', title: 'Customer call', start: '2026-11-13T14:00', end: '2026-11-13T15:00', category: 'blue' },          { id: 'retro', title: 'Retro', start: '2026-11-13T17:00', end: '2026-11-13T17:45' },          { id: 'planning', title: 'Planning', start: '2026-11-17T09:30', end: '2026-11-17T11:00', category: 'blue' },          { id: 'conference', title: 'Conference', start: '2026-11-19', end: '2026-11-22', allDay: true, category: 'violet' }        ]      }),    ]    return () => detach.forEach(stop => stop())  }</script><section class="schedule-view" id="team" aria-labelledby="team-title" {@attach mounted}>  <div class="schedule-view-header">    <button type="button" class="btn btn-sm schedule-view-today">Today</button>    <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-previous" aria-label="Previous">      <ChevronLeftIcon class="icon" />    </button>    <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-next" aria-label="Next">      <ChevronRightIcon class="icon" />    </button>    <h2 class="schedule-view-title" id="team-title" aria-live="polite">November 2026</h2>    <div class="segmented segmented-sm schedule-view-switch" role="radiogroup" aria-label="View">      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="day">Day      </label>      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="week">Week      </label>      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="month" checked>Month      </label>      <label class="segmented-item">        <input type="radio" class="segmented-input" name="team-view" value="agenda">Agenda      </label>    </div>  </div>  <div class="schedule-view-body"></div></section>
<script setup>import { onMounted, onUnmounted, ref } from 'vue'import { attach, schedule } from '@master/ui/behaviors'import ChevronLeftIcon from '@master/icons-vue/native/16/soft/chevron-left'import ChevronRightIcon from '@master/icons-vue/native/16/soft/chevron-right'const root = ref(null)let detach = []onMounted(() => {  detach = [    attach(root.value),    schedule(document.getElementById('team'), {      today: '2026-11-13', locale: 'en-US', weekStart: 1, value: { date: '2026-11-13', view: 'month' },      events: [        { id: 'review', title: 'Design review', start: '2026-11-03T10:00', end: '2026-11-03T11:30', category: 'violet' },        { id: 'offsite', title: 'Offsite', start: '2026-11-07', end: '2026-11-11', allDay: true, category: 'teal' },        { id: 'deploy', title: 'Deploy window', start: '2026-11-12T22:00', end: '2026-11-13T02:00', category: 'red' },        { id: 'launch', title: 'Launch', start: '2026-11-13', end: '2026-11-14', allDay: true, category: 'orange' },        { id: 'standup', title: 'Standup', start: '2026-11-13T09:00', end: '2026-11-13T09:15' },        { id: 'lunch', title: 'Team lunch', start: '2026-11-13T12:00', end: '2026-11-13T13:00', category: 'green' },        { id: 'call', title: 'Customer call', start: '2026-11-13T14:00', end: '2026-11-13T15:00', category: 'blue' },        { id: 'retro', title: 'Retro', start: '2026-11-13T17:00', end: '2026-11-13T17:45' },        { id: 'planning', title: 'Planning', start: '2026-11-17T09:30', end: '2026-11-17T11:00', category: 'blue' },        { id: 'conference', title: 'Conference', start: '2026-11-19', end: '2026-11-22', allDay: true, category: 'violet' }      ]    }),  ]})onUnmounted(() => detach.forEach(stop => stop()))</script><template>  <section ref="root" class="schedule-view" id="team" aria-labelledby="team-title">    <div class="schedule-view-header">      <button type="button" class="btn btn-sm schedule-view-today">Today</button>      <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-previous" aria-label="Previous">        <ChevronLeftIcon class="icon" />      </button>      <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-next" aria-label="Next">        <ChevronRightIcon class="icon" />      </button>      <h2 class="schedule-view-title" id="team-title" aria-live="polite">November 2026</h2>      <div class="segmented segmented-sm schedule-view-switch" role="radiogroup" aria-label="View">        <label class="segmented-item">          <input type="radio" class="segmented-input" name="team-view" value="day">Day        </label>        <label class="segmented-item">          <input type="radio" class="segmented-input" name="team-view" value="week">Week        </label>        <label class="segmented-item">          <input type="radio" class="segmented-input" name="team-view" value="month" checked>Month        </label>        <label class="segmented-item">          <input type="radio" class="segmented-input" name="team-view" value="agenda">Agenda        </label>      </div>    </div>    <div class="schedule-view-body"></div>  </section></template>
以月為單位移動、點按日期數字開啟該日,或切換到週檢視或議程。

#事件

每個事件都有一個固定不變的 id,以及 title、start 和 end。全天事件設定 allDay: true,起訖以日期表示(YYYY-MM-DD);其他事件則使用當地時間(YYYY-MM-DDTHH:mm)。end 不包含在內:只在 13 日的全天事件結束於 14 日,在午夜結束的事件則算在前一天。category 指定一組色盤,例如 blue 對應 category-blue;href 會讓事件成為連結,若沒有 href,事件會是一個 value 為其 id 的按鈕,由頁面監聽。

時間應已換算成日程表顯示時所在的時區,重複事件則應以各次發生的事件傳入:時區和重複規則由應用程式負責處理。日期依曆法計算並固定在正午,因此日光節約時間的切換不會讓全天事件移到前一天。檢視不會編輯、移動或儲存事件;它只負責顯示事件,並告知哪一個事件被按下。

#行為

app.js
import { schedule } from '@master/ui/behaviors/schedule.js'const team = schedule(document.querySelector('.schedule-view'), { events, today: '2026-11-13' })team.value // { date: '2026-11-13', view: 'month' }
選項預設值
events[]事件,格式如上
value今天所在的月份一開始要顯示的日期與檢視:{ date, view },檢視為 day、week、month 或 agenda 之一
today瀏覽器的日期今天,格式為 YYYY-MM-DD;由伺服器渲染日程表時請提供,讓兩端的日期一致
locale頁面的 lang用於星期與月份名稱的 BCP 47 標籤
weekStart依語言區域一週的第一天,0 為星期日,6 為星期六
lanes3月檢視中每天顯示的事件數,其餘收進「更多」按鈕
from、to8、18單日或一週至少顯示的時段;若有更早或更晚的事件,範圍會隨之延伸
messages英文橫帶的名稱、「更多」按鈕的文字與名稱,以及議程沒有事件時的句子
draw無接手寫出標題和內容,供自行輸出這些內容的渲染程式使用

讀者的操作會從根元素觸發 input 和 change;行為傳回的函式帶有可讀寫的 value,以程式設定它則不會觸發任何事件。scheduleLayout(value, options) 會以資料形式傳回檢視要顯示的內容:各週及每個事件所在的列、各時段及每個事件的位置、橫帶,以及議程的各天。因此伺服器、框架與行為能以相同方式排列相同的事件。

#日程表、甘特圖或月曆

日程表用來呈現依時間排列的事件:由上往下查看一天中的各個時段,或查看一個月中的各天。甘特圖用同一條時間刻度呈現計畫中各項工作的起訖時間,每項工作各占一列。月曆用來從整月檢視中選取一個日期或一段日期範圍,時間軸則按發生順序呈現各個時間點。

#無障礙

  • 將事件依時間順序寫成 <ol>,並為清單命名。單日檢視使用 aria-label,多日檢視則透過 aria-labelledby 引用當日標題作為其 schedule-day 的名稱。
  • 每個事件都用文字寫出標題和時間,並用 <time datetime> 標記時間。即使沒有視覺版面,也能讀出「設計審查,10:00 至 11:30」。時間軸只是同一套刻度的視覺呈現,請用 aria-hidden="true" 將它從輔助技術中隱藏。
  • 目前事件與今天都以 aria-current 標記,螢幕閱讀器會讀出這些狀態。目前時間線由樣式表繪製,請在需要提供目前時間的地方用文字標示。
  • 在強制色彩模式下,每個事件都有外框,目前事件會填入醒目提示色,整點細線與目前時間線則沿用系統色彩。
  • 月檢視不是日期格線:其中的日期是可開啟該日的數字,事件則是連結或按鈕,各自以標題和時間命名。「更多」按鈕會說明它列出幾個事件,以及是哪一天的事件。分類色從來不是區分事件的唯一方式。
  • 操作檢視的控制項時,焦點會留在使用中的控制項上;日期數字會隨月份一起被換掉,因此會將焦點交給它所開啟那一天的名稱。
  • 只要讀者可能身在其他時區,就在標題附近註明時間所採用的時區,例如「時間為台北時間(GMT+8)」:時間軸和事件只會顯示時鐘上的時間。

#React、Svelte 和 Vue

schedule 元件以 scheduleLayout() 寫出期間內容,因此伺服器送出的第一份 HTML 就已包含它;元件也會掛上行為,由行為回應標頭和日期數字的操作。它的值是 { date, view };按下沒有 href 的事件時,會觸發 onEventClick(在 Vue 中為 eventClick)。在伺服器上渲染時,請提供 today 和 locale。使用 npx master-ui add schedule 將它複製到專案中;React、Svelte 和 Vue 說明了這些元件的建構與使用方式。

ui/schedule.tsx
'use client'import { useId, useMemo, useState, type ComponentProps, type CSSProperties } from 'react'import { schedule, scheduleLayout, type ScheduleEvent, type ScheduleItem, type ScheduleMessages, type ScheduleValue } from '@master/ui/behaviors/schedule.js'import { useBehavior } from './use-behavior'export type { ScheduleEvent, ScheduleValue }/** The words of the header, in the page's language. */export interface ScheduleLabels {  today?: string  previous?: string  next?: string  /** The name of the view switch. */  view?: string  day?: string  week?: string  month?: string  agenda?: string}export interface ScheduleProps extends Omit<ComponentProps<'section'>, 'defaultValue' | 'children' | 'ref'> {  events: ScheduleEvent[]  /** The day and the view on show. Today's month by default. */  value?: ScheduleValue  defaultValue?: ScheduleValue  onValueChange?: (value: ScheduleValue) => void  /** An event without an `href` is a button: this hears it pressed. */  onEventClick?: (event: ScheduleEvent) => void  /** Today, as `YYYY-MM-DD`. Give it when the schedule is rendered on a server, so both sides agree. */  today?: string  /** A BCP 47 tag for the names. Give it when the schedule is rendered on a server. */  locale?: string  /** The first day of a week, 0 for Sunday to 6 for Saturday. The locale's own by default. */  weekStart?: number  /** How many events a day of a month shows before the rest go behind its more button. */  lanes?: number  /** The hours a day or a week shows at least. */  from?: number  to?: number  messages?: ScheduleMessages  labels?: ScheduleLabels}const chevron = (turn?: number) => (  <svg className="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform={turn ? `rotate(${turn} 8 8)` : undefined} /></svg>)const style = (properties: Record<string, string | number>) => properties as CSSProperties/** * A schedule the reader moves through by the day, the week, the month or as an agenda. React writes the * period from `scheduleLayout()`, the same layout the behavior writes, so it is in the first HTML; the behavior * answers the header and the day numbers and asks for the period to show. */export function Schedule({ events, value, defaultValue, onValueChange, onEventClick, today, locale, weekStart, lanes, from, to, messages, labels = {}, className, ...root }: ScheduleProps) {  const id = useId()  const settings = { today, locale, weekStart, lanes, from, to, messages }  const [first] = useState(() => scheduleLayout(value ?? defaultValue, settings).value)  const [shown, setShown] = useState(first)  const layout = useMemo(() => scheduleLayout(shown, { ...settings, events }), [shown, events, today, locale, weekStart, lanes, from, to, messages])  const ref = useBehavior(schedule, { ...settings, value: first, draw: setShown }, { value, defaultValue, onValueChange })  const more = messages?.more ?? ((count: number) => `+${count} more`)  const moreLabel = messages?.moreLabel ?? ((count: number, day: string) => `${count} more ${count === 1 ? 'event' : 'events'}, ${day}`)  const words = { today: 'Today', previous: 'Previous', next: 'Next', view: 'View', day: 'Day', week: 'Week', month: 'Month', agenda: 'Agenda', ...labels }  const event = (item: ScheduleItem, place?: Record<string, number>) => {    const content = <><span className="schedule-title">{item.title}</span>{item.time && !item.allDay ? <span className="schedule-time">{item.time}</span> : null}</>    const shared = { className: `schedule-event ${item.classes}`.trim(), style: place && style(Object.fromEntries(Object.entries(place).map(([name, number]) => [`--${name}`, number]))), 'aria-label': item.label }    return item.event.href      ? <a {...shared} href={item.event.href} key={`${item.id}${item.column}`}>{content}</a>      : <button type="button" {...shared} value={item.id} onClick={() => onEventClick?.(item.event)} key={`${item.id}${item.column}`}>{content}</button>  }  const list = (items: ScheduleItem[]) => <ol className="schedule-list">{items.map(item => <li key={item.id}>{event(item)}</li>)}</ol>  let body  if (layout.value.view === 'month') {    body = (      <div className="schedule-month">        <div className="schedule-weekdays" aria-hidden="true">{layout.weekdays.map(weekday => <span className="schedule-weekday" key={weekday.name}>{weekday.short}</span>)}</div>        <ol className="schedule-weeks">          {layout.weeks.map(week => (            <li className="schedule-week" style={style({ '--lanes': week.lanes })} key={week.days[0]!.date}>              {week.days.map((day, index) => [                <div className={day.outside ? 'schedule-date schedule-date-outside' : 'schedule-date'} style={style({ '--column': index + 1, '--count': day.count })} aria-current={day.today ? 'date' : undefined} key={day.date}>                  <button type="button" className="schedule-date-number" value={day.date} aria-label={day.summary}>{day.text}</button>                </div>,                ...day.items.map(item => event(item, { column: item.column, span: item.span, lane: item.lane })),                ...(day.hidden ? [                  <button type="button" className="schedule-more" style={style({ '--column': index + 1 })} popoverTarget={`${id}more${day.date}`} aria-label={moreLabel(day.hidden, day.label)} key={`${day.date}more`}>{more(day.hidden)}</button>,                  <div id={`${id}more${day.date}`} popover="" className="popover" key={`${day.date}list`}><p className="schedule-agenda-date">{day.label}</p>{list(day.all)}</div>,                ] : []),              ])}            </li>          ))}        </ol>      </div>    )  } else if (layout.value.view === 'agenda') {    body = layout.agenda.length      ? <ol className="schedule-agenda">{layout.agenda.map(day => <li className="schedule-agenda-day" aria-current={day.today ? 'date' : undefined} key={day.date}><h3 className="schedule-agenda-date">{day.heading}</h3>{list(day.items)}</li>)}</ol>      : <div className="empty"><p className="empty-title">{layout.words.empty}</p></div>  } else {    body = (      <div className="schedule" style={style({ '--schedule-from': layout.from, '--schedule-to': layout.to, '--schedule-days': layout.days.length })}>        <ol className="schedule-rail" aria-hidden="true">{layout.rail.map((label, index) => <li key={index}>{label}</li>)}</ol>        {layout.days.map((day, index) => (          <div className="schedule-day" style={style({ '--column': index + 1 })} aria-current={day.today ? 'date' : undefined} key={day.date}>            <h3 className="schedule-heading" aria-label={day.label}>{layout.days.length > 1 ? day.heading : day.label}</h3>            <ol className="schedule-events" aria-label={day.label}>{day.items.map(item => <li key={item.id}>{event(item, { start: item.start, end: item.end, lane: item.lane, lanes: item.lanes })}</li>)}</ol>          </div>        ))}        {layout.allDay.length ? (          <div className="schedule-allday" role="group" aria-label={layout.words.allDay}>            <span className="schedule-allday-label" aria-hidden="true">{layout.words.allDay}</span>            {layout.allDay.map(item => event(item, { column: item.column, span: item.span, lane: item.lane }))}          </div>        ) : null}      </div>    )  }  return (    <section className={className ? `schedule-view ${className}` : 'schedule-view'} aria-labelledby={`${id}title`} ref={ref} {...root}>      <div className="schedule-view-header">        <button type="button" className="btn btn-sm schedule-view-today">{words.today}</button>        <button type="button" className="btn btn-sm btn-square btn-quiet schedule-view-previous" aria-label={words.previous}>{chevron(180)}</button>        <button type="button" className="btn btn-sm btn-square btn-quiet schedule-view-next" aria-label={words.next}>{chevron()}</button>        <h2 className="schedule-view-title" id={`${id}title`} aria-live="polite">{layout.title}</h2>        <div className="segmented segmented-sm schedule-view-switch" role="radiogroup" aria-label={words.view}>          {(['day', 'week', 'month', 'agenda'] as const).map(name => (            <label className="segmented-item" key={name}><input type="radio" className="segmented-input" name={`${id}view`} value={name} defaultChecked={first.view === name} />{words[name]}</label>          ))}        </div>      </div>      <div className="schedule-view-body">{body}</div>    </section>  )}
ui/Schedule.svelte
<script lang="ts" module>  import type { HTMLAttributes } from 'svelte/elements'  import type { ScheduleEvent, ScheduleMessages, ScheduleValue } from '@master/ui/behaviors/schedule.js'  export type { ScheduleEvent, ScheduleValue }  /** The words of the header, in the page's language. */  export interface ScheduleLabels {    today?: string    previous?: string    next?: string    /** The name of the view switch. */    view?: string    day?: string    week?: string    month?: string    agenda?: string  }  export interface ScheduleProps extends Omit<HTMLAttributes<HTMLElement>, 'children'> {    events: ScheduleEvent[]    /** The day and the view on show. Bind it, or leave it out: today's month. */    value?: ScheduleValue    onValueChange?: (value: ScheduleValue) => void    /** An event without an `href` is a button: this hears it pressed. */    onEventClick?: (event: ScheduleEvent) => void    /** Today, as `YYYY-MM-DD`. Give it when the schedule is rendered on a server, so both sides agree. */    today?: string    /** A BCP 47 tag for the names. Give it when the schedule is rendered on a server. */    locale?: string    /** The first day of a week, 0 for Sunday to 6 for Saturday. The locale's own by default. */    weekStart?: number    /** How many events a day of a month shows before the rest go behind its more button. */    lanes?: number    /** The hours a day or a week shows at least. */    from?: number    to?: number    messages?: ScheduleMessages    labels?: ScheduleLabels  }</script><script lang="ts">  import { untrack } from 'svelte'  import { schedule, scheduleLayout, type ScheduleItem } from '@master/ui/behaviors/schedule.js'  import { behavior } from './behavior.svelte.js'  let { events, value = $bindable(), onValueChange, onEventClick, today, locale, weekStart, lanes, from, to, messages, labels = {}, class: className, ...root }: ScheduleProps = $props()  const id = $props.id()  const settings = () => ({ today, locale, weekStart, lanes, from, to, messages })  const first = untrack(() => scheduleLayout(value, settings()).value)  let shown = $state(first)  const layout = $derived(scheduleLayout(shown, { ...settings(), events }))  const attach = behavior(schedule, () => ({ ...settings(), value: first, draw: (next: ScheduleValue) => { shown = next } }), {    value: () => value,    change: (next) => { value = next; onValueChange?.(next) },  })  const more = $derived(messages?.more ?? ((count: number) => `+${count} more`))  const moreLabel = $derived(messages?.moreLabel ?? ((count: number, day: string) => `${count} more ${count === 1 ? 'event' : 'events'}, ${day}`))  const words = $derived({ today: 'Today', previous: 'Previous', next: 'Next', view: 'View', day: 'Day', week: 'Week', month: 'Month', agenda: 'Agenda', ...labels })  const views = ['day', 'week', 'month', 'agenda'] as const  const lane = (item: ScheduleItem) => `--column: ${item.column}; --span: ${item.span}; --lane: ${item.lane}`</script><!--  @component  A schedule the reader moves through by the day, the week, the month or as an agenda. Svelte writes the  period from `scheduleLayout()`, the same layout the behavior writes, so it is in the first HTML; the behavior  answers the header and the day numbers and asks for the period to show.-->{#snippet event(item: ScheduleItem, style?: string)}  {#if item.event.href}    <a class={['schedule-event', item.classes]} {style} href={item.event.href} aria-label={item.label}><span class="schedule-title">{item.title}</span>{#if item.time && !item.allDay}<span class="schedule-time">{item.time}</span>{/if}</a>  {:else}    <button type="button" class={['schedule-event', item.classes]} {style} value={item.id} aria-label={item.label} onclick={() => onEventClick?.(item.event)}><span class="schedule-title">{item.title}</span>{#if item.time && !item.allDay}<span class="schedule-time">{item.time}</span>{/if}</button>  {/if}{/snippet}{#snippet list(items: ScheduleItem[])}  <ol class="schedule-list">    {#each items as item (item.id)}<li>{@render event(item)}</li>{/each}  </ol>{/snippet}<section class={['schedule-view', className]} aria-labelledby="{id}title" {@attach attach} {...root}>  <div class="schedule-view-header">    <button type="button" class="btn btn-sm schedule-view-today">{words.today}</button>    <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-previous" aria-label={words.previous}>      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(180 8 8)" /></svg>    </button>    <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-next" aria-label={words.next}>      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" /></svg>    </button>    <h2 class="schedule-view-title" id="{id}title" aria-live="polite">{layout.title}</h2>    <div class="segmented segmented-sm schedule-view-switch" role="radiogroup" aria-label={words.view}>      {#each views as name (name)}        <label class="segmented-item"><input type="radio" class="segmented-input" name="{id}view" value={name} checked={first.view === name} />{words[name]}</label>      {/each}    </div>  </div>  <div class="schedule-view-body">    {#if layout.value.view === 'month'}      <div class="schedule-month">        <div class="schedule-weekdays" aria-hidden="true">          {#each layout.weekdays as weekday (weekday.name)}<span class="schedule-weekday">{weekday.short}</span>{/each}        </div>        <ol class="schedule-weeks">          {#each layout.weeks as week (week.days[0]!.date)}            <li class="schedule-week" style="--lanes: {week.lanes}">              {#each week.days as day, index (day.date)}                <div class={['schedule-date', day.outside && 'schedule-date-outside']} style="--column: {index + 1}; --count: {day.count}" aria-current={day.today ? 'date' : undefined}>                  <button type="button" class="schedule-date-number" value={day.date} aria-label={day.summary}>{day.text}</button>                </div>                {#each day.items as item (item.id)}{@render event(item, lane(item))}{/each}                {#if day.hidden}                  <button type="button" class="schedule-more" style="--column: {index + 1}" popovertarget="{id}more{day.date}" aria-label={moreLabel(day.hidden, day.label)}>{more(day.hidden)}</button>                  <div id="{id}more{day.date}" popover="" class="popover"><p class="schedule-agenda-date">{day.label}</p>{@render list(day.all)}</div>                {/if}              {/each}            </li>          {/each}        </ol>      </div>    {:else if layout.value.view === 'agenda'}      {#if layout.agenda.length}        <ol class="schedule-agenda">          {#each layout.agenda as day (day.date)}            <li class="schedule-agenda-day" aria-current={day.today ? 'date' : undefined}><h3 class="schedule-agenda-date">{day.heading}</h3>{@render list(day.items)}</li>          {/each}        </ol>      {:else}        <div class="empty"><p class="empty-title">{layout.words.empty}</p></div>      {/if}    {:else}      <div class="schedule" style="--schedule-from: {layout.from}; --schedule-to: {layout.to}; --schedule-days: {layout.days.length}">        <ol class="schedule-rail" aria-hidden="true">          {#each layout.rail as label, index (index)}<li>{label}</li>{/each}        </ol>        {#each layout.days as day, index (day.date)}          <div class="schedule-day" style="--column: {index + 1}" aria-current={day.today ? 'date' : undefined}>            <h3 class="schedule-heading" aria-label={day.label}>{layout.days.length > 1 ? day.heading : day.label}</h3>            <ol class="schedule-events" aria-label={day.label}>              {#each day.items as item (item.id)}<li>{@render event(item, `--start: ${item.start}; --end: ${item.end}; --lane: ${item.lane}; --lanes: ${item.lanes}`)}</li>{/each}            </ol>          </div>        {/each}        {#if layout.allDay.length}          <div class="schedule-allday" role="group" aria-label={layout.words.allDay}>            <span class="schedule-allday-label" aria-hidden="true">{layout.words.allDay}</span>            {#each layout.allDay as item (item.id)}{@render event(item, lane(item))}{/each}          </div>        {/if}      </div>    {/if}  </div></section>
ui/Schedule.vue
<script lang="ts">import type { ScheduleEvent, ScheduleValue } from '@master/ui/behaviors/schedule.js'export type { ScheduleEvent, ScheduleValue }/** The words of the header, in the page's language. */export interface ScheduleLabels {  today?: string  previous?: string  next?: string  /** The name of the view switch. */  view?: string  day?: string  week?: string  month?: string  agenda?: string}</script><script setup lang="ts">import { computed, shallowRef, useId, useTemplateRef } from 'vue'import { schedule, scheduleLayout, type ScheduleItem, type ScheduleMessages } from '@master/ui/behaviors/schedule.js'import { useBehavior } from './use-behavior'defineOptions({ inheritAttrs: false })const { events, today, locale, weekStart, lanes, from, to, messages, labels = {} } = defineProps<{  events: ScheduleEvent[]  /** Today, as `YYYY-MM-DD`. Give it when the schedule is rendered on a server, so both sides agree. */  today?: string  /** A BCP 47 tag for the names. Give it when the schedule is rendered on a server. */  locale?: string  /** The first day of a week, 0 for Sunday to 6 for Saturday. The locale's own by default. */  weekStart?: number  /** How many events a day of a month shows before the rest go behind its more button. */  lanes?: number  /** The hours a day or a week shows at least. */  from?: number  to?: number  messages?: ScheduleMessages  labels?: ScheduleLabels}>()/** The day and the view on show: `v-model`. Today's month by default. */const model = defineModel<ScheduleValue>()/** An event without an `href` is a button: `eventClick` hears it pressed. */const emit = defineEmits<{ eventClick: [event: ScheduleEvent] }>()/* * A schedule the reader moves through by the day, the week, the month or as an agenda. Vue writes the period * from `scheduleLayout()`, the same layout the behavior writes, so it is in the first HTML; the behavior answers * the header and the day numbers and asks for the period to show. */const id = useId()const settings = () => ({ today, locale, weekStart, lanes, from, to, messages })const first = scheduleLayout(model.value, settings()).valueconst shown = shallowRef<ScheduleValue>(first)const layout = computed(() => scheduleLayout(shown.value, { ...settings(), events }))const root = useTemplateRef<HTMLElement>('root')useBehavior(root, schedule, () => ({ ...settings(), value: first, draw: (next: ScheduleValue) => { shown.value = next } }), model)const more = computed(() => messages?.more ?? ((count: number) => `+${count} more`))const moreLabel = computed(() => messages?.moreLabel ?? ((count: number, day: string) => `${count} more ${count === 1 ? 'event' : 'events'}, ${day}`))const words = computed(() => ({ today: 'Today', previous: 'Previous', next: 'Next', view: 'View', day: 'Day', week: 'Week', month: 'Month', agenda: 'Agenda', ...labels }))const views = ['day', 'week', 'month', 'agenda'] as constconst lane = (item: ScheduleItem) => `--column: ${item.column}; --span: ${item.span}; --lane: ${item.lane}`const hours = (item: ScheduleItem) => `--start: ${item.start}; --end: ${item.end}; --lane: ${item.lane}; --lanes: ${item.lanes}`</script><template>  <section class="schedule-view" :aria-labelledby="`${id}-title`" ref="root" v-bind="$attrs">    <div class="schedule-view-header">      <button type="button" class="btn btn-sm schedule-view-today">{{ words.today }}</button>      <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-previous" :aria-label="words.previous">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(180 8 8)" /></svg>      </button>      <button type="button" class="btn btn-sm btn-square btn-quiet schedule-view-next" :aria-label="words.next">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" /></svg>      </button>      <h2 class="schedule-view-title" :id="`${id}-title`" aria-live="polite">{{ layout.title }}</h2>      <div class="segmented segmented-sm schedule-view-switch" role="radiogroup" :aria-label="words.view">        <label v-for="name in views" :key="name" class="segmented-item"><input type="radio" class="segmented-input" :name="`${id}-view`" :value="name" :checked="first.view === name" />{{ words[name] }}</label>      </div>    </div>    <div class="schedule-view-body">      <div v-if="layout.value.view === 'month'" class="schedule-month">        <div class="schedule-weekdays" aria-hidden="true">          <span v-for="weekday in layout.weekdays" :key="weekday.name" class="schedule-weekday">{{ weekday.short }}</span>        </div>        <ol class="schedule-weeks">          <li v-for="week in layout.weeks" :key="week.days[0]!.date" class="schedule-week" :style="`--lanes: ${week.lanes}`">            <template v-for="(day, index) in week.days" :key="day.date">              <div class="schedule-date" :class="{ 'schedule-date-outside': day.outside }" :style="`--column: ${index + 1}; --count: ${day.count}`" :aria-current="day.today ? 'date' : undefined">                <button type="button" class="schedule-date-number" :value="day.date" :aria-label="day.summary">{{ day.text }}</button>              </div>              <template v-for="item in day.items" :key="item.id">                <a v-if="item.event.href" :class="['schedule-event', item.classes]" :style="lane(item)" :href="item.event.href" :aria-label="item.label"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></a>                <button v-else type="button" :class="['schedule-event', item.classes]" :style="lane(item)" :value="item.id" :aria-label="item.label" @click="emit('eventClick', item.event)"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></button>              </template>              <template v-if="day.hidden">                <button type="button" class="schedule-more" :style="`--column: ${index + 1}`" :popovertarget="`${id}-more-${day.date}`" :aria-label="moreLabel(day.hidden, day.label)">{{ more(day.hidden) }}</button>                <div :id="`${id}-more-${day.date}`" popover="" class="popover">                  <p class="schedule-agenda-date">{{ day.label }}</p>                  <ol class="schedule-list">                    <li v-for="item in day.all" :key="item.id">                      <a v-if="item.event.href" :class="['schedule-event', item.classes]" :href="item.event.href" :aria-label="item.label"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></a>                      <button v-else type="button" :class="['schedule-event', item.classes]" :value="item.id" :aria-label="item.label" @click="emit('eventClick', item.event)"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></button>                    </li>                  </ol>                </div>              </template>            </template>          </li>        </ol>      </div>      <template v-else-if="layout.value.view === 'agenda'">        <ol v-if="layout.agenda.length" class="schedule-agenda">          <li v-for="day in layout.agenda" :key="day.date" class="schedule-agenda-day" :aria-current="day.today ? 'date' : undefined">            <h3 class="schedule-agenda-date">{{ day.heading }}</h3>            <ol class="schedule-list">              <li v-for="item in day.items" :key="item.id">                <a v-if="item.event.href" :class="['schedule-event', item.classes]" :href="item.event.href" :aria-label="item.label"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></a>                <button v-else type="button" :class="['schedule-event', item.classes]" :value="item.id" :aria-label="item.label" @click="emit('eventClick', item.event)"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></button>              </li>            </ol>          </li>        </ol>        <div v-else class="empty"><p class="empty-title">{{ layout.words.empty }}</p></div>      </template>      <div v-else class="schedule" :style="`--schedule-from: ${layout.from}; --schedule-to: ${layout.to}; --schedule-days: ${layout.days.length}`">        <ol class="schedule-rail" aria-hidden="true"><li v-for="(label, index) in layout.rail" :key="index">{{ label }}</li></ol>        <div v-for="(day, index) in layout.days" :key="day.date" class="schedule-day" :style="`--column: ${index + 1}`" :aria-current="day.today ? 'date' : undefined">          <h3 class="schedule-heading" :aria-label="day.label">{{ layout.days.length > 1 ? day.heading : day.label }}</h3>          <ol class="schedule-events" :aria-label="day.label">            <li v-for="item in day.items" :key="item.id">              <a v-if="item.event.href" :class="['schedule-event', item.classes]" :style="hours(item)" :href="item.event.href" :aria-label="item.label"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time" class="schedule-time">{{ item.time }}</span></a>              <button v-else type="button" :class="['schedule-event', item.classes]" :style="hours(item)" :value="item.id" :aria-label="item.label" @click="emit('eventClick', item.event)"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time" class="schedule-time">{{ item.time }}</span></button>            </li>          </ol>        </div>        <div v-if="layout.allDay.length" class="schedule-allday" role="group" :aria-label="layout.words.allDay">          <span class="schedule-allday-label" aria-hidden="true">{{ layout.words.allDay }}</span>          <template v-for="item in layout.allDay" :key="item.id">            <a v-if="item.event.href" :class="['schedule-event', item.classes]" :style="lane(item)" :href="item.event.href" :aria-label="item.label"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></a>            <button v-else type="button" :class="['schedule-event', item.classes]" :style="lane(item)" :value="item.id" :aria-label="item.label" @click="emit('eventClick', item.event)"><span class="schedule-title">{{ item.title }}</span><span v-if="item.time && !item.allDay" class="schedule-time">{{ item.time }}</span></button>          </template>        </div>      </div>    </div>  </section></template>

#類別

類別說明
schedule顯示從 --schedule-from 到 --schedule-to 的時段,每小時高度為 --schedule-hour。起始側排列時間標籤,接著每天各占一欄
schedule-now在 --now 的位置,於標有 aria-current="date" 的日期格內繪製帶圓點的前景色線,其餘日期格繪製極細線。若無日期格帶有此標記,則每格都繪製帶圓點的線。搭配 schedule 使用
schedule-rail從 --schedule-from 到 --schedule-to 每小時各有一個標籤,置中對齊對應的細線。各事件已用文字標示時間,請用 aria-hidden 對輔助技術隱藏這些標籤
schedule-day多天並排時,每天各占一欄,可在 schedule-events 上方加入 schedule-heading。用 aria-current="date" 標記今天。只顯示一天時,可省略這層欄位。
schedule-heading各欄上方以較淡的文字色顯示當天的名稱,今天的標題則使用醒目的文字色。
schedule-events依時間順序將當天的事件排在時間刻度上。每小時有一條水平細線,日期欄的起始側另有一條垂直細線。
schedule-event單一事件從 --start 到 --end,置於 --lanes 個並排欄位中的第 --lane 欄。事件以淡色底呈現,起始側內嵌前景色圓角長條,與細線相隔 1px。可套用在清單項目上,或套用在其中的連結或按鈕上。短事件維持單行。
schedule-title事件的內容:一行文字,過長時以省略號結尾。無論事件位於何處(時段上、月檢視、清單或議程中),事件中都有它
schedule-time事件的時間,以 <time> 元素撰寫:在標題下方以低調的一行呈現;在短事件中,若空間足夠,則與標題並排。無論事件位於何處(時段上、月檢視、清單或議程中),事件中都有它
schedule-event-lane放在事件列中而不是時段上:從第 --column 天開始,橫跨 --span 天,位於第 --lane 列,高度為一行。用於全天橫帶、月檢視和事件清單搭配 schedule-event 使用
schedule-event-continued在顯示範圍之前就已開始的事件片段:在時段上其頂端為直角,在事件列中其起點為直角,而且不顯示色條搭配 schedule-event 使用
schedule-event-continues延續到顯示範圍之後的事件片段:在時段上其底端為直角,在事件列中其終點為直角搭配 schedule-event 使用
schedule-event-plain月檢視或清單中的短事件:沒有面板,以圓點取代色條,接著是時間和標題搭配 schedule-event 使用
schedule-event-category套用其本身或外層 category-<name> 類別所設定分類的面板、色條與文字搭配 schedule-event 使用
schedule-allday位於標題下方、橫跨各日期欄的橫帶,放置持續整天的事件:每天以 --column 標明自己的欄,日程表則以 --schedule-days 說明共有幾欄。容納一個 schedule-allday-label 和事件列中的事件
schedule-allday-label橫帶在時間軸欄中的名稱,例如「全天」;加上 aria-hidden,橫帶則以其 aria-label 命名
schedule-month一個月:schedule-weekdays 位於 schedule-weeks 上方。空間較窄時,每天會為每個事件顯示一個圓點,而不顯示事件列
schedule-weekdays各週上方的星期名稱;由於每天的日期數字都有完整的名稱,因此加上 aria-hidden
schedule-weekday一個星期名稱
schedule-weeks依序排列的各週
schedule-week一週:七天,第一列是日期數字,接著是 --lanes 列事件,最後一列放「更多」按鈕。請依序寫出每一天、從那天開始的事件,以及那天的「更多」按鈕,讓它們依日期順序朗讀
schedule-date一天:在第 --column 欄中從該週頂端延伸到底端的格子,--count 為其事件數。請以 aria-current="date" 標記今天
schedule-date-outside前一個月或下一個月的日期:在淡色托盤上顯示較低調的數字搭配 schedule-date 使用
schedule-date-number該日的日期數字,是一個可開啟該日的圓形按鈕;其無障礙名稱為完整日期及其事件數。今天的數字會填上墨色
schedule-more超出事件列的其餘事件,位於該週最後一列的第 --column 欄:會開啟列出當天事件的彈出面板。其無障礙名稱說明還有幾個事件,以及是哪一天
schedule-list依先後順序排列的事件,以事件列中的事件上下排列:用於某一天的彈出面板,以及議程中的每一天
schedule-agenda期間內有事件的日期,每天一列:開頭是日期,旁邊是 schedule-list;空間較窄時則放在日期下方
schedule-agenda-day議程中的一天;請以 aria-current="date" 標記今天
schedule-agenda-date該日的日期,位於該列開頭,或在彈出面板中位於當天清單上方;今天的日期使用醒目的墨色
schedule-view讀者實際操作的日程表:schedule-view-header 位於 schedule-view-body 上方,由 schedule 行為驅動
schedule-view-header控制項:今天、上一個與下一個、期間名稱和檢視切換器;空間較窄時,名稱會獨占一行
schedule-view-title目前顯示的期間,例如「2026 年 11 月」;請標記 aria-live="polite",讓切換期間時能被朗讀出來
schedule-view-previous依檢視的期間往回移動
schedule-view-next依檢視的期間往前移動
schedule-view-today移到包含今天的期間
schedule-view-switch容納選擇檢視的單選按鈕,值為 day、week、month 和 agenda;是一個分段控制項
schedule-view-body行為寫出期間內容的地方:單日或一週的 schedule、schedule-month 或 schedule-agenda

#自訂屬性

屬性預設值說明
--schedule-from8起始小時,範圍為 0 到 24,支援小數
--schedule-to18日程表結束時間,以小時表示
--schedule-hour3rem每小時的顯示高度
--schedule-rail3rem標籤欄的寬度
--schedule-colorvar(--color-surface-inverse)用來為事件加上淡色背景及邊線的基準色
--nowschedule-now 指示線所在的時間,以小時表示,例如 13.5 代表下午一點半。設定於 schedule
--start事件開始時間,以小時表示。設定於 schedule-event
--end事件結束時間,以小時表示。設定於 schedule-event
--lane此事件在同時段重疊事件中的欄位索引,從起始側的 0 算起,預設為 0。設定於 schedule-event
--lanes此事件所在位置並排顯示的事件總數,預設為 1。設定於 schedule-event
--schedule-days並排的日期欄數,用於帶有全天橫帶的日程表;預設為 1設定於 schedule
--column在事件列中,事件在該列中開始的日期,從 1 起算;在 schedule-day、schedule-date 或 schedule-more 上,則是其所在的欄設定於 schedule-event
--span在事件列中,事件在該列中涵蓋的天數;預設為 1設定於 schedule-event
--lanes一週顯示的事件列數;預設為 3設定於 schedule-week
--count0當天的事件數,在較窄的月檢視中以最多三個圓點表示設定於 schedule-date

#原始程式碼

@master/ui/components/schedule.css
/* * Schedule: a day as hours down a rail, each event as tall as it lasts. * The hours run from --schedule-from to --schedule-to, each --schedule-hour tall, with a hairline at every * hour. A rail of labels stands at the start, each label on the middle of its hairline; it is a picture of the * scale and is hidden from assistive technology. The events of a day are an ordered list: each sets --start * and --end in hours and says its title and its time in words, so the list reads without the drawing. * An event is a quiet sheet of tinted ink with a rounded ink bar standing inside its start, straight from end * to end where an edge drawn along the sheet would bend round its corners. It is inset from the hairlines so that two * events that meet keep a line between them. Events that overlap share the width: --lane is the event's place * and --lanes how many stand side by side. An event is a size container, so a short one keeps its title on * one line, puts the time beside it when there is room, and with no room for a line shows only its sheet. * The event marked aria-current is ink. schedule-now draws an ink line with a dot at --now, through the day * marked aria-current="date", and as a hairline through the other days; it passes under the events, so it * never strikes through their words. * Several days stand side by side as schedule-day columns, each with an optional heading over it. * Everything is placed by the stylesheet; nothing is measured by a script. * * Events that last whole days stand in lanes rather than on the hours: in schedule-allday, a band under the * headings, and in schedule-month, a month as weeks of seven days. Such an event (schedule-event-lane) spans * --span days from day --column on lane --lane; a piece that began in an earlier week or goes on past this one * is schedule-event-continued or schedule-event-continues, with square ends where it goes on. An event of a few * hours in a month is plain: a dot, its time and its title. A day of a month shows three lanes and a * schedule-more button for the rest; in a narrow month the lanes give way to a dot for each event under the day's * number, which opens the day. schedule-agenda lists the same events by day, for a narrow room or a reader who * would rather read than look. A category colors an event's sheet, bar and words (schedule-event-category). * * schedule-view is the schedule a reader works: a header with previous, today and next, the period's name and a * switch between day, week, month and agenda, over a body the schedule behavior writes from the events. */@layer components.ui {  .schedule {    --schedule-from: 8;    --schedule-to: 18;    --schedule-hour: 3rem;    --schedule-rail: 3rem;    --schedule-color: var(--color-surface-inverse);    /* The surface the schedule stands on, which a card or a sheet publishes; the event's tint is mixed with it. */    --schedule-surface: var(--surface-color, var(--color-surface-base));    --schedule-span: calc(var(--schedule-to) - var(--schedule-from));    display: grid;    grid-template-rows: auto calc(var(--schedule-span) * var(--schedule-hour));    grid-template-columns: var(--schedule-rail);    grid-auto-columns: minmax(0, 1fr);    grid-auto-flow: column;    min-width: 0;    margin: 0;    padding-block-end: .5rem;    color: var(--color-text-body);    font: 400 .8125rem/1.25rem var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    /* Without headings, the first label stands half above the first hour: keep it in the box. */    &:not(:has(.schedule-heading)) {      padding-block-start: .5rem;    }    /*     * With an all-day band, the headings, the band and the hours are three rows. The band runs across the days, so     * each day names its column with --column, from 1, and the schedule says how many there are in --schedule-days.     */    &:has(.schedule-allday) {      grid-template-rows: auto auto calc(var(--schedule-span) * var(--schedule-hour));      .schedule-rail {        grid-row: 3;      }      .schedule-day {        grid-column: calc(var(--column) + 1);        grid-row: 1 / span 3;      }      .schedule-events {        grid-row: 3;      }    }    /* Now: an ink line across the day, and a dot where it meets the day's edge. */    &.schedule-now .schedule-events {      &::before, &::after {        content: '';        position: absolute;        pointer-events: none;      }      /* The line passes under the events, so it never strikes through their words. */      &::after {        z-index: 0;        top: calc((var(--now, var(--schedule-from)) - var(--schedule-from)) * var(--schedule-hour));        inset-inline: 0;        height: 1px;        background: var(--color-text-strong);      }      &::before {        top: calc((var(--now, var(--schedule-from)) - var(--schedule-from)) * var(--schedule-hour) - 3px);        inset-inline-start: -3px;        width: 7px;        height: 7px;        z-index: 2;        border-radius: 999px;        corner-shape: round;        background: var(--color-text-strong);        box-shadow: 0 0 0 1.5px var(--schedule-surface);      }      @media (forced-colors: active) {        &::before, &::after {          forced-color-adjust: none;          background: CanvasText;        }      }    }    /* When one day is today, the line runs through the others as a hairline, with no dot. */    &.schedule-now:has(.schedule-day[aria-current="date"]) .schedule-day:not([aria-current="date"]) .schedule-events {      &::before {        content: none;      }      &::after {        background: var(--color-line-mark);        /* Kept out of forced colors with the line, so the hairline is the system's gray rather than a faint ink. */        @media (forced-colors: active) {          background: GrayText;        }      }    }    /* The ring that cuts the dot of now out of the line is the canvas, as a chart's and a heatmap's surface is. */    @media (forced-colors: active) {      --schedule-color: CanvasText;      --schedule-surface: Canvas;    }  }  /* The labels of the hours, one to an hour, each centered on its hairline. */  .schedule-rail {    display: grid;    grid-area: 2 / 1;    grid-auto-rows: var(--schedule-hour);    align-content: start;    margin: -.5rem 0 0;    padding: 0;    padding-inline-end: .5rem;    color: var(--color-text-muted);    /* The size of a chart's and a gantt's ticks. */    font-size: .71875rem;    line-height: 1rem;    list-style: none;    text-align: end;    white-space: nowrap;  }  /* One day: its heading over its events, on the schedule's own rows. */  .schedule-day {    display: grid;    grid-row: 1 / span 2;    grid-template-rows: subgrid;    min-width: 0;    margin: 0;  }  /* The name of a day, over its column. Today's takes the strong ink. */  .schedule-heading {    grid-row: 1;    min-width: 0;    margin: 0;    padding-block-end: .75rem;    overflow: hidden;    color: var(--color-text-muted);    font-size: .75rem;    font-weight: var(--font-weight-control);    line-height: 1rem;    text-align: center;    text-overflow: ellipsis;    white-space: nowrap;    .schedule-day[aria-current="date"] & {      color: var(--color-text-strong);    }  }  /*   * The events of a day, and the scale behind them: a hairline at every hour, one down the day's start, and   * the closing hairline under the last hour. The hours begin after the upright line, so no crossing is drawn twice.   */  .schedule-events {    --schedule-inset: 2px;    --schedule-inset-end: .5rem;    --schedule-lane-gap: 3px;    --schedule-line: var(--color-line-hair);    position: relative;    grid-row: 2;    min-width: 0;    margin: 0;    padding: 0;    /* Events, the line of now and a focused event stack inside the day, never over a sticky heading above it. */    isolation: isolate;    background:      linear-gradient(var(--schedule-line), var(--schedule-line)) left / 1px 100% no-repeat,      repeating-linear-gradient(180deg, var(--schedule-line) 0 1px, transparent 1px var(--schedule-hour)) right / calc(100% - 1px) 100% no-repeat;    box-shadow: 0 1px 0 var(--schedule-line);    list-style: none;    &:dir(rtl) {      background:        linear-gradient(var(--schedule-line), var(--schedule-line)) right / 1px 100% no-repeat,        repeating-linear-gradient(180deg, var(--schedule-line) 0 1px, transparent 1px var(--schedule-hour)) left / calc(100% - 1px) 100% no-repeat;    }    /* The hairlines stay, in the system's gray; the events inside keep the system's colors. */    @media (forced-colors: active) {      --schedule-line: GrayText;      forced-color-adjust: none;    }  }  /*   * One event, from --start to --end in hours, in lane --lane of --lanes. It stands a pixel clear of the   * hairline over it and the one under it. It goes on the list item, or on a link or a button inside one.   */  .schedule-event {    --schedule-length: calc((var(--end, 1) - var(--start, 0)) * var(--schedule-hour) - 3px);    --schedule-cell: calc((100% - var(--schedule-inset) - var(--schedule-inset-end) + var(--schedule-lane-gap)) / var(--lanes, 1));    --schedule-tint: color-mix(in oklab, var(--schedule-color) 7%, var(--schedule-surface));    --schedule-edge: color-mix(in oklab, var(--schedule-color) 62%, transparent);    --schedule-bar: 3px;    --schedule-bar-inset: 3px;    position: absolute;    z-index: 1;    top: calc((var(--start, 0) - var(--schedule-from)) * var(--schedule-hour) + 2px);    inset-inline-start: calc(var(--schedule-inset) + var(--lane, 0) * var(--schedule-cell));    container: schedule-event / size;    display: flex;    flex-flow: row wrap;    align-content: flex-start;    column-gap: .375rem;    box-sizing: border-box;    width: calc(var(--schedule-cell) - var(--schedule-lane-gap));    height: max(var(--schedule-length), 2px);    margin: 0;    /* A short event centers its one line; a longer one keeps the same inset at its top. */    padding: clamp(0px, (var(--schedule-length) - 1rem) / 2, .25rem) .375rem;    padding-inline-start: calc(var(--schedule-bar-inset) + var(--schedule-bar) + .3125rem);    border: 0;    border-radius: calc(var(--radius-chip) * var(--corner-scale));    corner-shape: var(--corner-shape);    overflow: hidden;    background: var(--schedule-tint);    color: var(--color-text-strong);    box-shadow: inset 0 0 0 .5px color-mix(in oklab, var(--schedule-color) 12%, transparent);    font: inherit;    font-feature-settings: inherit;    text-align: start;    text-decoration: none;    appearance: none;    -webkit-tap-highlight-color: transparent;    /* A button the behavior writes for an event the page opens answers the pointer as a link does. */    &:enabled {      cursor: pointer;    }    /*     * The bar: 3px wide, 3px in from the start and from the top and bottom, round at both ends, in a firm tint     * of the ink so it marks the event without shouting over its words. On an event too short to hold it     * inset, it comes out to the sheet's edges and stays a line rather than shrinking to a dot.     */    &::before {      content: '';      position: absolute;      inset-block: clamp(0px, (var(--schedule-length) - 12px) / 2, var(--schedule-bar-inset));      inset-inline-start: var(--schedule-bar-inset);      width: var(--schedule-bar);      border-radius: calc(var(--schedule-bar) / 2);      corner-shape: round;      background: var(--schedule-edge);      pointer-events: none;      @media (forced-colors: active) {        forced-color-adjust: none;        background: CanvasText;      }    }    /*     * In a lane: --span days from day --column, on lane --lane, one line high. In a month the first row is the     * day's number; in the all-day band the first column is the rail's.     */    &.schedule-event-lane {      --schedule-length: var(--schedule-lane-height, 1.375rem);      position: relative;      top: auto;      inset-inline-start: auto;      grid-column: calc(var(--column, 1) + var(--schedule-lane-column, 0)) / span var(--span, 1);      grid-row: calc(var(--lane, 0) + var(--schedule-lane-row, 1));      flex-wrap: nowrap;      align-items: center;      align-content: center;      width: auto;      min-width: 0;      height: var(--schedule-length);      margin-inline: 2px;      padding-block: 0;    }    /*     * A piece of an event that began before what is shown, or goes on after it: on the hours, past midnight, its     * top or its bottom is square and the bar runs to that edge; in a lane, past the week, its start or its end.     */    &.schedule-event-continued {      border-start-start-radius: 0;      border-start-end-radius: 0;      &::before {        inset-block-start: 0;        border-start-start-radius: 0;        border-start-end-radius: 0;      }    }    &.schedule-event-continues {      border-end-start-radius: 0;      border-end-end-radius: 0;      &::before {        inset-block-end: 0;        border-end-start-radius: 0;        border-end-end-radius: 0;      }    }    &.schedule-event-lane.schedule-event-continued {      margin-inline-start: 0;      padding-inline-start: .5rem;      border-start-start-radius: 0;      border-end-start-radius: 0;      border-start-end-radius: calc(var(--radius-chip) * var(--corner-scale));      border-end-end-radius: calc(var(--radius-chip) * var(--corner-scale));      /* It is not the start, so it has no bar. */      &::before {        content: none;      }    }    &.schedule-event-lane.schedule-event-continues {      margin-inline-end: 0;      border-start-end-radius: 0;      border-end-end-radius: 0;      &:not(.schedule-event-continued) {        border-start-start-radius: calc(var(--radius-chip) * var(--corner-scale));        border-end-start-radius: calc(var(--radius-chip) * var(--corner-scale));      }      &::before {        inset-block: clamp(0px, (var(--schedule-length) - 12px) / 2, var(--schedule-bar-inset));        border-radius: calc(var(--schedule-bar) / 2);      }    }    /* Plain: an event of a few hours in a month. No sheet, a dot for the bar, then its time and its title. */    &.schedule-event-plain {      --schedule-tint: transparent;      /* The words start as far past the dot as the dot stands in: at the bar's inset they touched it. */      padding-inline-start: calc(.3125rem + 6px + .3125rem);      box-shadow: none;      color: var(--color-text-body);      &::before {        inset-block: calc(50% - 3px);        inset-inline-start: .3125rem;        width: 6px;        height: 6px;        border-radius: 999px;        background: var(--schedule-edge);      }      .schedule-time {        flex: none;        order: -1;      }    }    /* A category: its surface for the sheet, its mark for the bar and its text for the words. */    &.schedule-event-category {      --schedule-tint: var(--category-surface, color-mix(in oklab, var(--schedule-color) 7%, var(--schedule-surface)));      --schedule-edge: var(--category-mark, color-mix(in oklab, var(--schedule-color) 62%, transparent));      color: var(--category-text, var(--color-text-strong));      box-shadow: inset 0 0 0 .5px var(--category-line, color-mix(in oklab, var(--schedule-color) 12%, transparent));      /* A plain event keeps the body's ink: its dot carries the category. */      &.schedule-event-plain {        --schedule-tint: transparent;        box-shadow: none;        color: var(--color-text-body);      }    }    /* Under the pointer the sheet is a step firmer, at once. */    @media (hover: hover) {      &:hover:not([aria-current="true"]) {        --schedule-tint: color-mix(in oklab, var(--schedule-color) 12%, var(--schedule-surface));      }      &.schedule-event-category:hover:not([aria-current="true"]) {        --schedule-tint: color-mix(in oklab, var(--category-mark, var(--schedule-color)) 14%, var(--category-surface, var(--schedule-surface)));      }      &.schedule-event-plain:hover:not([aria-current="true"]) {        --schedule-tint: color-mix(in oklab, var(--schedule-color) 6%, transparent);      }    }    /* The event that matters now, or the one that is open: ink. */    &[aria-current="true"] {      --schedule-edge: color-mix(in oklab, var(--color-text-inverse) 55%, transparent);      background: var(--schedule-color);      color: var(--color-text-inverse);      box-shadow: var(--shadow-ink-top);    }    &:focus-visible, &:has(:focus-visible) {      @apply --focus-ring;      z-index: 3;    }    @media (forced-colors: active) {      forced-color-adjust: auto;      outline: 1px solid CanvasText;      outline-offset: -1px;      &[aria-current="true"] {        forced-color-adjust: none;        background: Highlight;        color: HighlightText;        /* The bar stands on the highlight now, so it takes the highlight's text color, as the words do. */        &::before {          background: HighlightText;        }      }      /* The focus ring is the system's highlight, as every control's is in forced colors. */      &:focus-visible, &:has(:focus-visible) {        outline: 2px solid Highlight;        outline-offset: 2px;      }    }  }  /* What the event is: one line that ends in an ellipsis. */  .schedule-title {    flex: 1 0 100%;    min-width: 0;    margin: 0;    overflow: hidden;    font-size: .75rem;    font-weight: var(--font-weight-control);    line-height: 1rem;    text-overflow: ellipsis;    white-space: nowrap;  }  /* When it is: a quiet line under the title, in tabular figures. */  .schedule-time {    flex: 1 0 100%;    min-width: 0;    margin: 0;    overflow: hidden;    color: var(--color-text-muted);    font-size: .6875rem;    line-height: 1rem;    text-overflow: ellipsis;    white-space: nowrap;    .schedule-event[aria-current="true"] & {      color: color-mix(in oklab, var(--color-text-inverse) 72%, transparent);    }    /* On a category's surface the time keeps the category's text, which is the ink that reads there. */    .schedule-event-category:not([aria-current="true"]) & {      color: inherit;    }    @media (forced-colors: active) {      color: inherit;    }  }  /* A short event: the time beside the title when both fit, and under it, out of sight, when they do not. */  @container schedule-event (height < 2rem) {    .schedule-title, .schedule-time {      flex: 0 1 auto;    }    .schedule-time {      flex-shrink: 0;    }  }  /* Under a line's height: the sheet alone. Its words stay for assistive technology. */  @container schedule-event (height < .875rem) {    .schedule-title, .schedule-time {      opacity: 0;    }  }}@layer components.ui {  /*   * The all-day band: a row under the headings, across the days, with a lane for each event that runs a whole   * day or more. Its first column is the rail's, where its name stands. A hairline closes it above the hours.   */  .schedule-allday {    --schedule-lane-column: 1;    display: grid;    grid-row: 2;    grid-column: 1 / span calc(var(--schedule-days, 1) + 1);    grid-template-columns: subgrid;    grid-auto-rows: 1.375rem;    row-gap: 2px;    align-content: start;    min-height: 1.375rem;    margin: 0 0 .5rem;    padding: 0 0 .375rem;    box-shadow: 0 1px 0 var(--color-line-hair);    list-style: none;    /* The closing hairline is a shadow, which forced colors drop: a line of the system's gray takes a pixel of the padding. */    @media (forced-colors: active) {      padding-block-end: calc(.375rem - 1px);      border-block-end: 1px solid GrayText;    }  }  /* The name of the band, in the rail: "All day". */  .schedule-allday-label {    grid-column: 1;    grid-row: 1;    align-self: center;    padding-inline-end: .5rem;    color: var(--color-text-muted);    font-size: .71875rem;    line-height: 1rem;    text-align: end;    white-space: nowrap;  }  /*   * A month: the names of the weekdays over its weeks. It is a size container, so a narrow month shows each day's   * events as dots under its number and leaves the words to the day it opens.   */  .schedule-month {    --schedule-color: var(--color-surface-inverse);    --schedule-surface: var(--surface-color, var(--color-surface-base));    container: schedule-month / inline-size;    display: grid;    grid-template-columns: minmax(0, 1fr);    min-width: 0;    color: var(--color-text-body);    font: 400 .8125rem/1.25rem var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    @media (forced-colors: active) {      --schedule-color: CanvasText;    }  }  .schedule-weekdays {    display: grid;    grid-template-columns: repeat(7, minmax(0, 1fr));    padding-block-end: .5rem;    color: var(--color-text-muted);    font-size: .75rem;    font-weight: var(--font-weight-control);    line-height: 1rem;  }  .schedule-weekday {    min-width: 0;    padding-inline: .5rem;    overflow: hidden;    text-overflow: ellipsis;    white-space: nowrap;  }  .schedule-weeks {    display: grid;    margin: 0;    padding: 0;    box-shadow: 0 -1px 0 var(--color-line-hair);    list-style: none;  }  /*   * A week: seven columns, the day's number on the first row, --lanes rows of events under it, and a row for the   * days that have more than the lanes hold. Each day is a cell from the top to the bottom of the week.   */  .schedule-week {    --schedule-lane-row: 2;    display: grid;    grid-template-columns: repeat(7, minmax(0, 1fr));    grid-template-rows: 2.25rem repeat(var(--lanes, 3), 1.375rem) 1.375rem;    row-gap: 2px;    padding-block-end: .375rem;    box-shadow: 0 1px 0 var(--color-line-hair);  }  /* A day of a month: a cell the height of its week, with a hairline at its end. */  .schedule-date {    --count: 0;    display: flex;    flex-direction: column;    align-items: flex-start;    grid-column: var(--column, 1);    grid-row: 1 / -1;    min-width: 0;    margin-block-end: -.375rem;    padding: .375rem;    /* A hairline at the end of every day but the last of the week, which stands at the month's edge. */    box-shadow: inset calc(-1px * min(1, 7 - var(--column, 1))) 0 0 var(--color-line-hair);    &:dir(rtl) {      box-shadow: inset calc(1px * min(1, 7 - var(--column, 1))) 0 0 var(--color-line-hair);    }    /* A day of the month before or after: a quieter number on a faint tray. */    &.schedule-date-outside {      background: color-mix(in oklab, var(--color-surface-tray) 45%, transparent);      color: var(--color-text-muted);    }    /*     * The month's hairlines are shadows, which forced colors drop: every day is outlined in the system's gray     * instead, half a pixel in, so the outlines of neighbors fall on one line. A day outside the month is gray too.     */    @media (forced-colors: active) {      outline: 1px solid GrayText;      outline-offset: -.5px;      &.schedule-date-outside {        color: GrayText;      }    }  }  /* The day's number: a round button that opens the day. Today's is ink. */  .schedule-date-number {    display: inline-grid;    flex: none;    place-items: center;    min-width: 1.5rem;    height: 1.5rem;    margin: 0;    padding: 0 .3125rem;    border: 0;    border-radius: 999px;    corner-shape: round;    background: transparent;    color: inherit;    font: var(--font-weight-control) .75rem/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    text-decoration: none;    appearance: none;    cursor: pointer;    -webkit-tap-highlight-color: transparent;    @media (hover: hover) {      &:hover {        background: var(--color-surface-chip);        color: var(--color-text-strong);      }    }    &:focus-visible {      @apply --focus-ring;    }    .schedule-date[aria-current="date"] & {      background: var(--color-surface-inverse);      color: var(--color-text-inverse);      box-shadow: var(--shadow-ink-top);    }    @media (forced-colors: active) {      .schedule-date[aria-current="date"] & {        forced-color-adjust: none;        background: Highlight;        color: HighlightText;      }      &:focus-visible {        outline-color: Highlight;      }    }  }  /* The rest of a day's events, past its lanes: a quiet button on the week's last row that lists them. */  .schedule-more {    grid-column: var(--column, 1);    grid-row: -2;    justify-self: start;    align-self: center;    margin: 0 2px;    padding: 0 .375rem;    height: 1.25rem;    border: 0;    border-radius: calc(var(--radius-chip) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: transparent;    color: var(--color-text-muted);    font: var(--font-weight-control) .6875rem/1 var(--font-family-sans);    font-feature-settings: inherit;    /* The font shorthand resets the figures the month sets: the count keeps its tabular ones. */    font-variant-numeric: tabular-nums;    white-space: nowrap;    appearance: none;    cursor: pointer;    -webkit-tap-highlight-color: transparent;    /* 20px tall in its lane: on touch its target reaches 24px, as far as the lanes over and under it allow. */    @media (pointer: coarse) {      position: relative;      &::after {        content: '';        position: absolute;        inset: -2px 0;      }    }    @media (hover: hover) {      &:hover {        background: var(--color-surface-chip);        color: var(--color-text-strong);      }    }    &:focus-visible {      @apply --focus-ring;      @media (forced-colors: active) {        outline-color: Highlight;      }    }  }  /* A narrow month: a dot for each event, three at most, under the day's number; the number opens the day. */  @container schedule-month (width < 36rem) {    .schedule-week {      grid-template-rows: 3rem;      padding-block-end: 0;      .schedule-event, .schedule-more {        display: none;      }    }    .schedule-weekday {      padding-inline: 0;      text-align: center;    }    .schedule-date {      align-items: center;      margin-block-end: 0;      padding: .25rem 0;      &::after {        content: '';        width: calc(min(var(--count), 3) * 6px);        height: 4px;        margin-block-start: .1875rem;        background: radial-gradient(circle, var(--color-text-muted) 1.5px, transparent 2px) 0 0 / 6px 4px repeat-x;        /* The dots are a gradient, which forced colors would drop: kept out of them, in the system's text color. */        @media (forced-colors: active) {          forced-color-adjust: none;          background: radial-gradient(circle, CanvasText 1.5px, transparent 2px) 0 0 / 6px 4px repeat-x;        }      }    }    .schedule-date-number {      min-width: 2rem;      height: 2rem;      font-size: .8125rem;      /*       * Here the number is the only way into the day, with no events under it: on touch its target reaches 44px       * tall, short of the next week's, and the number keeps its size. It grows up and down only, since on a phone       * seven days leave a column narrower than 44px.       */      @media (pointer: coarse) {        position: relative;        &::after {          @apply --touch-target-block;        }      }    }  }  /* A list of events, in the order they come: a day's in its popover, and each day's in the agenda. */  .schedule-list {    display: flex;    flex-direction: column;    gap: 2px;    min-width: 0;    margin: 0;    padding: 0;    /* In a day's popover the list stands outside the month: its times keep the tabular figures the month sets. */    font-variant-numeric: tabular-nums;    list-style: none;    .schedule-event {      --schedule-lane-height: 1.625rem;    }  }  /*   * Agenda: the period's days that have events, one to a row: the date at the start, its events beside it. In a   * narrow room the date stands over its events.   */  .schedule-agenda {    --schedule-color: var(--color-surface-inverse);    --schedule-surface: var(--surface-color, var(--color-surface-base));    container: schedule-agenda / inline-size;    display: grid;    margin: 0;    padding: 0;    color: var(--color-text-body);    font: 400 .8125rem/1.25rem var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    list-style: none;  }  .schedule-agenda-day {    display: grid;    grid-template-columns: 7rem minmax(0, 1fr);    gap: .25rem 1rem;    padding-block: .75rem;    box-shadow: 0 1px 0 var(--color-line-hair);    &:last-child {      box-shadow: none;    }    /* The hairline between days is a shadow, which forced colors drop: a line of the system's gray takes a pixel of the padding. */    @media (forced-colors: active) {      padding-block-end: calc(.75rem - 1px);      border-block-end: 1px solid GrayText;      &:last-child {        padding-block-end: .75rem;        border-block-end: 0;      }    }  }  .schedule-agenda-date {    margin: 0;    padding-block-start: .1875rem;    color: var(--color-text-muted);    font-size: .75rem;    font-weight: var(--font-weight-control);    line-height: 1.25rem;    .schedule-agenda-day[aria-current="date"] & {      color: var(--color-text-strong);    }  }  @container schedule-agenda (width < 28rem) {    .schedule-agenda-day {      grid-template-columns: minmax(0, 1fr);    }  }  /*   * A schedule a reader works: a header of controls over the body the schedule behavior writes. The header keeps   * the period's name between the turns and the switch, and puts the name on a line of its own when the room is narrow.   */  .schedule-view {    container: schedule-view / inline-size;    display: grid;    grid-template-columns: minmax(0, 1fr);    gap: 1rem;    min-width: 0;  }  .schedule-view-header {    display: flex;    flex-wrap: wrap;    align-items: center;    gap: .5rem .75rem;    min-width: 0;  }  /* The period on show: "November 2026". Announced when it changes. */  .schedule-view-title {    flex: 1 1 auto;    min-width: 0;    margin: 0;    color: var(--color-text-strong);    font: var(--font-weight-control) 1rem/1.5rem var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    text-wrap: balance;    overflow-wrap: anywhere;  }  .schedule-view-switch, .schedule-view-today, .schedule-view-previous, .schedule-view-next {    flex: none;  }  /* Back and on point the way the days run: where they run from the right, the square turns round. */  .schedule-view-previous, .schedule-view-next {    &:dir(rtl) {      scale: -1 1;    }  }  @container schedule-view (width < 34rem) {    .schedule-view-title {      flex-basis: 100%;      order: -1;    }    .schedule-view-switch {      margin-inline-start: auto;    }  }  /* The body the behavior writes; it takes the room the header leaves and keeps the schedule's own scrolling. */  .schedule-view-body {    min-width: 0;    &:focus-visible {      @apply --focus-ring;      @media (forced-colors: active) {        outline-color: Highlight;      }    }  }}