EventSched
The EventSched component renders a collapsible schedule by day, with event times, titles, speakers, and details. It is used on the Triennial Gathering event page and includes built-in accordion behavior with accessible markup.
Overview
Section titled “Overview”File: src/components/EventSched.astro
Data config: src/data/events/triennialGathering2026Schedule.ts
Used on: src/pages/triennial-gathering-2026.astro
This component is ideal for:
- Displaying multi-day conference schedules
- Grouping sessions under date headings
- Keeping long agendas readable with collapsible panels
interface Event { readonly time?: string; readonly title: string; readonly speaker?: string; readonly details?: string;}
interface EventDay { readonly date: string; readonly description?: string; readonly events: readonly Event[];}
interface Props { schedule: readonly EventDay[];}Prop details
Section titled “Prop details”schedule: Array of event days; each day includes a date label and events list
-
Import the component and schedule data:
---import EventSched from '../components/EventSched.astro';import { triennialGathering2026Schedule } from '../data/events/triennialGathering2026Schedule';--- -
Render the schedule in the page:
<EventSched schedule={triennialGathering2026Schedule} /> -
Update schedule data in the data file:
- Path:
src/data/events/triennialGathering2026Schedule.ts - Add or edit dates and events
- Path:
Data configuration
Section titled “Data configuration”Example schedule entry
Section titled “Example schedule entry”export const triennialGathering2026Schedule = [ { date: 'March 30, 2026', description: 'Conference Day', events: [ { time: '09:15 – 09:45', title: 'Opening Keynote', speaker: 'Margrét Manda Jónsdóttir', details: 'Landspítali University Hospital, Nurse Manager', }, ], },] as const;Component behavior
Section titled “Component behavior”- Each date row is a toggle button with
aria-expandedstate - The schedule body expands by animating the grid row height
- Chevron icon rotates to indicate open/closed state
- Only the clicked date toggles; multiple dates can be open at once
Accessibility
Section titled “Accessibility”- Hidden h2 (
sr-only) improves document outline aria-controlslinks button and panelrole="region"witharia-labelledbyper day- Keyboard focus styles via
focus-visiblering
Styling details
Section titled “Styling details”- Container:
max-w-4xlwith horizontal padding - Card:
rounded-lgwithborderandshadow-sm - Hover: Slight shadow increase and light background change
- Time badge: Mono font with blue background and icon
- Expanded state: Rounded corners adapt to open/closed state
JavaScript lifecycle
Section titled “JavaScript lifecycle”The component binds a single click handler and cleans up on view transitions.
const initEventAccordion = () => { accordionController = new AbortController(); document.addEventListener('click', handleAccordionClick, { signal });};
document.addEventListener('astro:page-load', initEventAccordion);document.addEventListener('astro:before-swap', () => { accordionController?.abort();});Troubleshooting
Section titled “Troubleshooting”Accordion does not expand
Section titled “Accordion does not expand”- Confirm the
.event-togglebutton exists and hasaria-expanded - Check for JavaScript errors in the browser console
- Ensure no other script stops propagation on the button
Chevron icon does not rotate
Section titled “Chevron icon does not rotate”- Verify the
.chevronclass exists on the SVG - Confirm the
rotate-180class is available in Tailwind
Related components
Section titled “Related components”- EventHeaderSection - Event hero with countdown
- RegistrationSection - Registration form section
- BannerTriennialGathering - Event highlight banner