Vanilla Breeze

week-view

7-day time grid composing day-view-style columns in a semantic table with auto mode, spanning events, and keyboard navigation.

Overview

The <week-view> component renders a weekly schedule as a semantic <table> styled with CSS Grid and subgrid. Each column represents a day; each row an hour. Events are <calendar-event> elements placed in the correct cell, with support for multi-hour spanning and double-booking.

Auto Mode

Place <calendar-event> children with data-date attributes directly inside <week-view>. The component scans event dates and times, computes the hour range, and builds the table automatically.

Each <calendar-event> must have data-date="YYYY-MM-DD" to assign it to a day column, and a <time datetime="HH:MM"> for the hour slot.

Attributes

AttributeTypeDefaultDescription
data-start-date ISO date First day of the week (e.g., 2026-04-06).
data-days number 7 Number of day columns. Use 5 for a workweek.
data-start-hour number | "auto" "auto" First visible hour, or "auto" to compute from events.
data-end-hour number 19 Last visible hour. Ignored when data-start-hour="auto".

Workweek

Set data-days="5" to show Monday through Friday only.

Multi-Hour Events

Add data-duration to span across hour rows, matching the <day-view> pattern.

Table Structure

The generated table uses semantic elements for accessibility: <th scope="col"> for day headers and <th scope="row"> for hour labels. CSS Grid with subgrid provides the visual layout.

ElementPurpose
<table>Grid container for the hours × days layout
<thead> <th>Day column headers with <time> elements
<tbody> <th>Hour row headers with <time datetime="HH:00">
<td>Day/hour cell containing <hour-view> + events

Events

EventDetailDescription
week-view:event-click { date, time, text, element, category, duration } Fired when a <calendar-event> is clicked.

Keyboard

KeyAction
Arrow DownNext event in same day column
Arrow UpPrevious event in same day column
Arrow RightNext event in same hour row
Arrow LeftPrevious event in same hour row

Progressive Enhancement

LayerWhat renders
HTML onlyCalendar events render as a flat list (readable without JS)
+ CSSGrid table layout with day columns and hour rows
+ JSAuto table generation, spanning events, click handling, keyboard nav

Related