A schedule view is a team's calendar on one sheet: a header to move through it, the period written from the events, and the details of an event a reader opens. The schedule and its behavior do the calendar; the block adds the sheet, the events of a real week and the drawer.
Schedule view
<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' },]Blocks are markup to copy. They take the page's own text color and size; the previews set fg-text-body text-sm on the body. Each block is a size container, so it reflows by its own width: in a wide page, a sidebar's worth of room or a dialog.
#What is in it
- One sheet holds a
schedule-view. Its header has today, previous and next, the period's name, announced when it changes, and a segmented switch between day, week, month and agenda. - The events are data.
events.jsis a week as an application hands it over: days for what lasts all day, local times for the rest, each end exclusive, and a category for the calendar it belongs to. Theschedulebehavior lays them out; it never edits or stores one. - A category is named. Each calendar's color comes with its name in the drawer's badge, and the event's title says what it is.
- An event opens a drawer. An event without a link is a button whose
valueis its id; the page listens for it and fills a dialog drawer with its time, its place and who is in it. A day's list is a popover, which closes behind the drawer. - A narrow room keeps reading. The month shows a dot for each event under a day's number, the header puts the period's name on a line of its own, and the agenda lists the month by day.
#What needs a script
main.js attaches the behavior with the events and today's date and opens the drawer. Moving between periods and views, and laying out the month, the week and the agenda, is the behavior's. Creating, moving and saving events, time zones and repeating events stay with the application, which hands the schedule the events of the period it shows.
#Accessibility
- The sheet is named "Team calendar", and the period's name is a live region that says where a move went.
- A day's number is named with its date and how many events it holds; a more button says how many more and on which day.
- An event is named with its title and when it is. The drawer is a modal dialog named by the event's title, and it gives focus back to the event when it closes.
- A category's color is never alone: its name is in the drawer.
#Related
- ScheduleEvents placed in time: a day or a week as hours down a rail, a month as weeks of lanes, or an agenda.
- Segmented controlA few options in one well; a sheet glides to the current one.
- DialogA native modal on an overlay sheet, opened and closed without script.
- Data listThe facts about one thing, as terms and values.
- BadgeA small chip for a status, a category or a count.
- CategoryNamed colors that tell which category a piece of data belongs to.
- PopoverA floating sheet anchored to the button that opens it.
- SurfaceTrays, sheets and wells: the material ladder every component is built on.
- ButtonA raised control that lifts on hover and sinks when pressed.