/*!
MIT License
Copyright (c) 2026 Jaison
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import {useState} from 'react';
import {DayAgenda,type ScheduleSnapshot} from '@bld8/ui';
import '@bld8/ui/styles.css';
const snapshot:ScheduleSnapshot={revision:1,slots:[{id:'morning',start:'2026-11-11T09:00:00Z',end:'2026-11-11T12:00:00Z'}],events:[{id:'review',revision:1,title:'Existing example review',start:'2026-11-11T10:00:00Z',end:'2026-11-11T10:30:00Z'}]};
export default function AgendaExample(){const [selected,setSelected]=useState<string|null>(null),[message,setMessage]=useState('');return <div><DayAgenda label="Example available times" day="2026-11-11" timeZone="UTC" snapshot={snapshot} durationMinutes={30} selectedStart={selected} onSelectStart={slot=>{setSelected(slot.start);setMessage('Inspected '+slot.start+'. No booking was saved.');}} onEventAction={event=>setMessage(event.title)}/><p role="status">{message}</p></div>;}
In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.
API & behaviour
A bounded single-day agenda over supplied UTC availability windows and events. Uses the selected IANA zone and locale for display, with explicit UTC offsets to distinguish repeated local times. All source instants use whole-minute precision. Availability starts sample every 15 elapsed minutes, for 15–120 minute appointments. Source windows and events are separately nonoverlapping, each at most 24 hours; snapshots allow 200 windows and 500 events. Native buttons provide keyboard actions; loading/error/empty states are explicit. No arbitrary wall-clock-to-UTC conversion, recurrence, calendar sync, drag/resizing, service fetching or production availability generation is included. Layout follows its container; detail forms belong to the host. See /integrations/scheduling.
DayAgenda
DayAgenda public properties
Prop
Type
Default
dayRequired
string
Calendar date in the chosen zone, as YYYY-MM-DD.
—
labelRequired
string
—
snapshotRequired
ScheduleSnapshot
Complete bounded availability windows and appointments.
—
timeZoneRequired
string
—
disabled
boolean | undefined
false
durationMinutes
number | undefined
Elapsed minutes: 15–120, in steps of 15.
30
error
string | undefined
—
loading
boolean | undefined
false
locale
string | undefined
'en-AU'
onEventAction
((event: ScheduleEvent) => void) | undefined
—
onRetry
(() => void) | undefined
—
onSelectStart
((start: ScheduleStart) => void) | undefined
—
selectedStart
string | null | undefined
—
ScheduleSnapshot
ScheduleSnapshot public properties
Prop
Type
Default
eventsRequired
ScheduleEvent[]
—
revisionRequired
number
—
slotsRequired
ScheduleSlot[]
—
ScheduleSlot
ScheduleSlot public properties
Prop
Type
Default
endRequired
string
—
idRequired
string
—
startRequired
string
—
ScheduleEvent
ScheduleEvent public properties
Prop
Type
Default
endRequired
string
—
idRequired
string
—
revisionRequired
number
—
startRequired
string
—
titleRequired
string
—
ScheduleStart
ScheduleStart public properties
Prop
Type
Default
endRequired
string
—
slotIdRequired
string
—
startRequired
string
—
Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.
Related controls
Notes to self
Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.