スケジュールビューは、1 枚のシートにまとめたチームのカレンダーです。期間を移動するためのヘッダー、予定データをもとに表示するカレンダー、ユーザーが開いた予定の詳細で構成します。カレンダーの部分はスケジュールとそのビヘイビアが担当し、ブロックはシート、実際の 1 週間分の予定、ドロワーを加えます。
スケジュールビュー
<section class="sheet p-lg" data-example="schedule-view" aria-label="Team calendar"> <div class="schedule-view" id="team"> <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" 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> </div> <dialog class="dialog dialog-drawer" id="team-event" closedby="any" aria-labelledby="team-event-title"> <header class="dialog-header"> <p class="m(0)"> <span class="badge badge-category badge-dot" id="team-event-calendar"></span> </p> <h2 class="dialog-title" id="team-event-title"></h2> <p class="dialog-description" id="team-event-when"></p> </header> <div class="dialog-body"> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Where</dt> <dd class="data-list-value" id="team-event-where"></dd> </div> <div class="data-list-item"> <dt class="data-list-term">Who</dt> <dd class="data-list-value" id="team-event-who"></dd> </div> </dl> </div> <footer class="dialog-footer"> <button type="button" class="btn" commandfor="team-event" command="close">Close</button> </footer> </dialog></section>import { schedule } from '@master/ui/behaviors/schedule.js'import { calendars, events } from './events.js'/** * A team calendar: the schedule behavior writes the period from the events, and an event, a button without a * link, opens its details in a drawer. Returns the function that stops it. */export function mount(root) { const view = root.querySelector('.schedule-view') const dialog = root.querySelector('dialog') const field = (name) => root.querySelector(`#team-event-${name}`) const detach = schedule(view, { events, today: '2026-11-13', locale: 'en-US', weekStart: 1, value: { date: '2026-11-13', view: 'month' } }) const controller = new AbortController() view.addEventListener('click', (click) => { const button = click.target.closest('button.schedule-event') const event = button && events.find((each) => each.id === button.value) if (!event) return const badge = field('calendar') badge.className = `badge badge-category badge-dot category-${event.category}` badge.textContent = calendars[event.category] field('title').textContent = event.title field('when').textContent = button.getAttribute('aria-label').slice(event.title.length + 2) field('where').textContent = event.where field('who').textContent = event.who // A day's list is a popover in the top layer; the drawer goes over it, and the list closes behind it. The // event's own button is then hidden, so when the drawer closes focus goes to the button that opened the list. const list = button.closest('[popover]') const opener = list ? view.querySelector(`[popovertarget="${list.id}"]`) : null list?.hidePopover() if (opener) dialog.addEventListener('close', () => opener.focus(), { once: true, signal: controller.signal }) dialog.showModal() }, { signal: controller.signal }) return () => { controller.abort() detach() if (dialog.open) dialog.close() }}/** * A week of a design team's calendar, as an application hands it to the schedule: days for all-day events, * local times for the others, each end exclusive, and a category for the calendar it belongs to. */export const calendars = { violet: 'Research', teal: 'Design system', orange: 'Launch', blue: 'Customers', green: 'Team',}export const events = [ { id: 'interviews', title: 'User interviews', start: '2026-11-03T10:00', end: '2026-11-03T11:30', category: 'violet', where: 'Room 4', who: 'Yi-ching, Misaki' }, { id: 'offsite', title: 'Design offsite', start: '2026-11-07', end: '2026-11-11', allDay: true, category: 'green', where: 'Lisbon', who: 'The whole team' }, { id: 'audit', title: 'Token audit', start: '2026-11-10T13:00', end: '2026-11-10T15:00', category: 'teal', where: 'Online', who: 'Kenta, Ji-hoon' }, { id: 'deploy', title: 'Deploy window', start: '2026-11-12T22:00', end: '2026-11-13T01:00', category: 'orange', where: 'On call', who: 'Seo-yeon' }, { id: 'launch', title: 'Launch day', start: '2026-11-13', end: '2026-11-14', allDay: true, category: 'orange', where: 'Everywhere', who: 'Everyone' }, { id: 'standup', title: 'Standup', start: '2026-11-13T09:00', end: '2026-11-13T09:15', category: 'green', where: 'Online', who: 'The whole team' }, { id: 'review', title: 'Design review', start: '2026-11-13T10:00', end: '2026-11-13T11:30', category: 'teal', where: 'Room 2', who: 'Yi-ching, Kenta' }, { id: 'lunch', title: 'Team lunch', start: '2026-11-13T12:00', end: '2026-11-13T13:00', category: 'green', where: 'Canteen', who: 'The whole team' }, { id: 'call', title: 'Customer call', start: '2026-11-13T14:00', end: '2026-11-13T15:00', category: 'blue', where: 'Online', who: 'Misaki' }, { id: 'retro', title: 'Retro', start: '2026-11-13T16:30', end: '2026-11-13T17:15', category: 'green', where: 'Room 4', who: 'The whole team' }, { id: 'planning', title: 'Planning', start: '2026-11-17T09:30', end: '2026-11-17T11:00', category: 'teal', where: 'Room 2', who: 'Ji-hoon' }, { id: 'synthesis', title: 'Research synthesis', start: '2026-11-18T14:00', end: '2026-11-18T16:00', category: 'violet', where: 'Room 4', who: 'Yi-ching' }, { id: 'conference', title: 'Design conference', start: '2026-11-19', end: '2026-11-22', allDay: true, category: 'violet', where: 'Berlin', who: 'Yi-ching, Misaki' }, { id: 'onboarding', title: 'Onboarding', start: '2026-11-24T10:00', end: '2026-11-24T12:00', category: 'blue', where: 'Room 1', who: 'Seo-yeon' },]日付の数字からその日を開いたり、予定を開いて詳細を見たり、週表示やアジェンダに切り替えたりできます。
ブロックはコピーして使えるマークアップです。文字色と文字サイズはページから引き継ぎます。プレビューでは body に fg-text-body text-sm を設定しています。各ブロックはサイズコンテナーで、広いページでも、サイドバーほどの幅でも、ダイアログ内でも、自身の幅に応じて配置が変わります。
#構成
- 1 枚のシート に
schedule-viewを入れます。ヘッダーには、今日、前へ、次へ、変わったときに読み上げられる期間の名前、日・週・月・アジェンダを切り替えるセグメントコントロールがあります。 - 予定はデータです。
events.jsは、アプリケーションが渡す形の 1 週間分の予定です。終日の予定は日付で、それ以外はローカル時刻で表し、終了時点はいずれも含みません。各予定には、属するカレンダーを示すカテゴリーを指定します。予定を配置するのはscheduleビヘイビアで、予定を編集したり保存したりすることはありません。 - カテゴリーには名前を添えます。 各カレンダーの色は、ドロワーのバッジでその名前とともに表示され、予定のタイトルが内容を伝えます。
- 予定を開くとドロワーが開きます。 リンクのない予定は、id を
valueに持つボタンです。ページはそれを受け取り、ダイアログのドロワーに時刻、場所、参加者を表示します。1 日の予定一覧はポップオーバーで、ドロワーの背後で閉じます。 - 狭い領域でも読み続けられます。 月表示では日付の数字の下に予定ごとのドットを表示し、ヘッダーは期間の名前を独立した 1 行に置き、アジェンダは 1 か月を日ごとに一覧表示します。
#スクリプトが必要な処理
main.js は、予定と今日の日付を渡してビヘイビアを適用し、ドロワーを開きます。期間の移動、ビューの切り替え、月・週・アジェンダ表示での予定の配置はビヘイビアが担当します。予定の作成、移動、保存、タイムゾーン、繰り返しの予定はアプリケーションが扱い、表示する期間の予定をスケジュールに渡します。
#アクセシビリティ
- シートの名前は「Team calendar」で、期間の名前はライブリージョンとして、移動先を伝えます。
- 日付の数字には、その日付と予定の件数を含む名前を付けます。「さらに表示」ボタンでは、あと何件あり、それが何日かを伝えます。
- 予定には、タイトルと日時を含む名前を付けます。ドロワーは予定のタイトルを名前とするモーダルダイアログで、閉じると予定にフォーカスを戻します。
- カテゴリーの色だけで伝えることはしません。ドロワーにカテゴリー名を表示します。
#関連項目
- スケジュール予定を時間軸上に配置します。日や週は時刻を縦軸に、月は週ごとのレーンで、またはアジェンダとして表示します。
- セグメントコントロールくぼんだトラックに少数の選択肢を並べ、選択された項目へハイライトが滑らかに移動します。
- ダイアログオーバーレイとして表示され、スクリプトなしで開閉できるネイティブのモーダルです。
- データリスト1 つの対象の情報を、細い線で区切った項目名と値で表示します。デプロイ、注文、プロフィールなどに。
- バッジステータス、カテゴリー、件数を示す小さなチップ。色に意味があるとき以外はニュートラルな色で表示します。
- カテゴリーカラーデータがどのカテゴリーに属するかを示す、名前付きの色。
- ポップオーバー開くボタンを基準に表示されるフローティングパネル。
- サーフェストレイ、シート、ウェル。すべてのコンポーネントの土台となる、奥行きの異なる素材です。
- ボタン面からわずかに浮いた操作要素です。ポインターを重ねるとさらに浮き上がり、押すと沈み込みます。