Forms

Calendar.

Dates with predictable keyboard navigation and clear selection.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/calendar.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Choose a calendar date

An explicit month avoids clock-dependent initial content.

Loads this example when you need it.

Keyboard

  • Arrow keys move day focus.
  • Enter or Space selects a date.

States covered

  • Selected date
  • No selection
  • Minimum date

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-basic-calendar.json
Complete source
React / TypeScript
/*!
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 {Calendar} from '@bld8/ui';
import '@bld8/ui/styles.css';
export default function CalendarExample(){const [date,setDate]=useState<Date|undefined>(new Date(2026,10,11));return <div><Calendar label="Example review date" value={date} onValueChange={setDate} defaultMonth={new Date(2026,10,1)} minDate={new Date(2026,10,1)}/><p>{date?date.toLocaleDateString('en-AU'):'No date selected'}</p></div>;}

Month and year navigation with one availability rule

Navigate two months with compact month and year choices. The same unavailable dates and weekday policy validate calendar picks, typed dates and explicit date ranges.

Keyboard

  • Month and Year choices support arrow navigation and typeahead. Day buttons retain calendar arrow, Home, End and Page keys.
  • Type an unavailable date or a range crossing one: submission keeps the draft and focuses the invalid text.

States covered

  • Two-month display
  • Controlled month
  • Custom month and year choices
  • Exact unavailable dates
  • Weekday policy
  • Shared typed validation
  • Responsive month and year groups
  • English and Arabic navigation

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-calendar-navigation-availability.json
Complete source
React / TypeScript
/*!
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 '@bld8/ui/styles.css';
import {useState} from 'react';
import {Button,Calendar,DatePicker,DateRangePicker,formatDateValue,parseDateValue,UIProvider} from '@bld8/ui';
const date=(value:string)=>parseDateValue(value)!;
const unavailable=[date('2026-11-17')],weekend=(value:Date)=>value.getDay()===0||value.getDay()===6;
export default function CalendarAvailabilityExample(){const [month,setMonth]=useState(date('2026-11-01')),[selected,setSelected]=useState<Date|undefined>(date('2026-11-16')),[status,setStatus]=useState('No available date submitted.'),[arabic,setArabic]=useState(false);return <UIProvider locale={arabic?'ar':'en-AU'} direction={arabic?'rtl':'ltr'}><div style={{display:'grid',gap:24,maxWidth:720}}>
  <Button variant="secondary" onClick={()=>setArabic(value=>!value)}>{arabic?'Use English calendar':'Use Arabic calendar'}</Button>
  <Calendar label="Review calendar" navigation="dropdowns" month={month} onMonthChange={setMonth} numberOfMonths={2} value={selected} onValueChange={setSelected} startMonth={date('2025-01-01')} endMonth={date('2027-12-01')} minDate={date('2026-11-01')} maxDate={date('2027-05-31')} unavailableDates={unavailable} isDateUnavailable={weekend}/>
  <p data-calendar-selection>{'Selected: '+formatDateValue(selected)}</p>
  <form aria-label="Available date form" style={{display:'grid',gap:20}} onSubmit={event=>{event.preventDefault();const data=new FormData(event.currentTarget);setStatus('Date: '+data.get('available')+' | Range: '+data.get('period.from')+' to '+data.get('period.to'));}}>
    <DatePicker label="Available review date" editable name="available" defaultValue={date('2026-11-16')} minDate={date('2026-11-01')} maxDate={date('2027-05-31')} unavailableDates={unavailable} isDateUnavailable={weekend} navigation="dropdowns"/>
    <DateRangePicker label="Available period" editable name="period" commitMode="explicit" defaultValue={{from:date('2026-11-02'),to:date('2026-11-04')}} minDate={date('2026-11-01')} maxDate={date('2027-05-31')} unavailableDates={unavailable} isDateUnavailable={weekend} navigation="dropdowns" numberOfMonths={2}/>
    <Button type="submit">Read available dates</Button>
  </form><p role="status">{status}</p>
</div></UIProvider>;}

Quick reference

React / TypeScript
<Calendar label="Review date" value={date} onValueChange={setDate}
  minDate={new Date(2026,9,5)} />
<Calendar mode="range" value={range} onValueChange={setRange} />

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

Styled React DayPicker 10.0.2, using the shared light/dark tokens. Controlled single-date or range selection, defaultMonth or controlled month/onMonthChange, minDate/maxDate, locale, weekStartsOn and disabled. navigation=dropdowns adds custom month/year choices; numberOfMonths supports one to three panels. unavailableDates and isDateUnavailable share the typed date/range availability rule. Arrow/Home/End/PageUp/PageDown navigation is maintained upstream. Values are local Date objects; use formatDateValue for date-only YYYY-MM-DD values. No time or timezone scheduling is implied.

Calendar

Calendar public properties
PropTypeDefault
autoFocusboolean | undefined—
defaultMonthDate | undefined—
disabledboolean | undefined—
endMonthDate | undefined—
isDateUnavailable((date: Date) => boolean) | undefined

Pure synchronous host policy; no network or zone conversion. Throwing fails closed.

—
labelstring | undefined—
localeDayPickerLocale | undefined—
maxDateDate | undefined—
minDateDate | undefined—
mode"range" | "single" | undefined—
monthDate | undefined

Optional controlled visible month, independent of selection.

—
navigation"buttons" | "dropdowns" | undefined'buttons'
numberOfMonths1 | 2 | 3 | undefined1
onMonthChange((month: Date) => void) | undefined—
onValueChange((value: Date | undefined) => void) | ((value: DateRange | undefined) => void) | undefined—
startMonthDate | undefined

Additional navigation bounds. Day-level minDate/maxDate remain authoritative.

—
unavailableDatesreadonly Date[] | undefined

Exact local civil dates. Invalid entries are ignored.

—
valueDate | DateRange | undefined—
weekStartsOn0 | 5 | 1 | 2 | 3 | 4 | 6 | undefined1

CalendarBaseProps

CalendarBaseProps public properties
PropTypeDefault
autoFocusboolean | undefined—
defaultMonthDate | undefined—
disabledboolean | undefined—
endMonthDate | undefined—
isDateUnavailable((date: Date) => boolean) | undefined

Pure synchronous host policy; no network or zone conversion. Throwing fails closed.

—
labelstring | undefined—
localeDayPickerLocale | undefined—
maxDateDate | undefined—
minDateDate | undefined—
monthDate | undefined

Optional controlled visible month, independent of selection.

—
navigation"buttons" | "dropdowns" | undefined—
numberOfMonths1 | 2 | 3 | undefined—
onMonthChange((month: Date) => void) | undefined—
startMonthDate | undefined

Additional navigation bounds. Day-level minDate/maxDate remain authoritative.

—
unavailableDatesreadonly Date[] | undefined

Exact local civil dates. Invalid entries are ignored.

—
weekStartsOn0 | 5 | 1 | 2 | 3 | 4 | 6 | undefined—

DateAvailability

DateAvailability public properties
PropTypeDefault
isDateUnavailable((date: Date) => boolean) | undefined

Pure synchronous host policy; no network or zone conversion. Throwing fails closed.

—
unavailableDatesreadonly Date[] | undefined

Exact local civil dates. Invalid entries are ignored.

—

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.