An explicit event calendar
The date, UTC instants and display zone are supplied by the host.
Loads this example when you need it.
Keyboard
- Arrow keys navigate calendar days.
- Enter chooses a day; labelled event buttons inspect an event.
States covered
- Week or month
- Selected day
- Event detail
Install this complete example and its component dependencies.
npx shadcn@latest add https://ui.bld8.dev/r/example-basic-event-calendar.jsonComplete source
/*!
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 {EventCalendar,type CalendarView} from '@bld8/ui';
import '@bld8/ui/styles.css';
const events=[{id:'review',title:'Example interface review',start:'2026-11-11T10:00:00Z',end:'2026-11-11T11:00:00Z'}];
export default function EventsExample(){const [date,setDate]=useState('2026-11-11'),[view,setView]=useState<CalendarView>('month'),[detail,setDetail]=useState('');return <div><EventCalendar label="Example team calendar" date={date} onDateChange={setDate} view={view} onViewChange={setView} events={events} timeZone="UTC" today="2026-11-11" onEventAction={event=>setDetail(event.title+' · '+event.start)}/><p role="status">{detail}</p></div>;}