calendar-event

Styled event block for day, hour, and week schedule views. CSS-only custom element with category colors, icons, and duration support.

Overview

The <calendar-event> element is a CSS-only custom element for displaying events inside schedule views. It provides category-based color theming, icon support, half-hour positioning, and expandable details — all without JavaScript.

Used as a child of <hour-view> inside <day-view>.

Attributes

AttributeValuesDescription
data-category meeting, deadline, personal, focus Sets --event-color for the accent bar and background tint.
data-start 30 Places the event in the bottom half of its hour row (half-hour start).
data-duration 1h, 1h30m, 2h, 3h Multi-hour events. JS positions them absolutely to span across hour rows.

Content

Events can contain any combination of:

ElementPurpose
<time datetime="HH:MM">Event start time (displayed as label)
<time datetime="PT1H">Duration (hidden visually, used for positioning)
<icon-wc>Event icon
<details>Expandable extra information
Text contentEvent title/description

Category Colors

Each category sets a --event-color custom property that controls the left accent bar and background tint.

CategoryColor
meetingPrimary (blue/interactive)
deadlineError (red)
personalSuccess (green)
focusAmber/olive

Add custom categories via CSS: calendar-event[data-category="workshop"] { --event-color: purple; }

Related

  • <hour-view> — Container for events within an hour
  • <day-view> — Full day schedule using these events