导航

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 上将时间范围设为从 --schedule-from 到 --schedule-to。每小时的高度由 --schedule-hour 指定,默认为 48px。每个 schedule-event 都用 --start 和 --end 在同一时间刻度上指定起止时刻,以小时为单位,因此上午 10 点半写作 10.5,下午 1 点 45 分写作 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 中。这条横栏位于标题下方、小时刻度上方,其名称(例如“All day”)显示在时间轴所在的列。横栏中的每个事件都是一个 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 后事件成为链接,否则它是一个按钮,其 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,多天并排时,在每天的 schedule-day 上用 aria-labelledby 引用各自的标题。
  • 每个事件都用文字写明标题和时间,并用 <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,所在轨道由 --lane 指定,轨道总数由 --lanes 指定。事件使用淡色背景,起始边内侧有一根圆角墨色条,事件块与刻度细线相隔一像素。将类加在列表项上,或加在列表项内的链接或按钮上。时长较短的事件以单行显示。
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-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;      }    }  }}