Calendar
A Gregorian calendar supporting single, multiple, and range date selection with localized weekdays, presets, and composable month/year controls.
A Gregorian calendar component supporting single, multiple, and range date selection, localized weekday headers, RTL keyboard navigation, and composable month/year pickers. The examples on this page use the Shadcn Rhea style preset.
Preview
Section titled “Preview”<proto-ui-shadcn-calendar-root
id="calendar-caption-demo"
class="rounded-lg border border-border"
>
<proto-ui-shadcn-calendar-caption>
<proto-ui-shadcn-calendar-previous aria-label="Previous month">
‹
</proto-ui-shadcn-calendar-previous>
<proto-ui-shadcn-select-root id="calendar-month">
<!-- Month Select -->
</proto-ui-shadcn-select-root>
<proto-ui-shadcn-select-root id="calendar-year">
<!-- Year Select -->
</proto-ui-shadcn-select-root>
<proto-ui-shadcn-calendar-next aria-label="Next month">
›
</proto-ui-shadcn-calendar-next>
</proto-ui-shadcn-calendar-caption>
<proto-ui-shadcn-calendar-heading
class="sr-only"
></proto-ui-shadcn-calendar-heading>
<proto-ui-shadcn-calendar-grid>
<proto-ui-shadcn-calendar-weekdays>
<!-- 7 Weekday slots with offset 0..6 -->
</proto-ui-shadcn-calendar-weekdays>
<!-- 6 Row slots (index 0..5), each with 7 Day slots (offset 0..41) -->
</proto-ui-shadcn-calendar-grid>
</proto-ui-shadcn-calendar-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
import { bindCalendarCaption } from '@proto.ui/prototypes-base/calendar';
const root = document.querySelector('#calendar-caption-demo');
setElementProps(root, {
styleProfile: 'rhea',
locale: 'en-US',
weekStartsOn: 0,
today: '2026-10-08',
});
// Connect month/year Select controls via bindCalendarCaption(source, { month, year })
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases (@proto.ui/prototypes-shadcn/calendar).
import { CalendarRoot, CalendarCaption, CalendarPrevious, CalendarHeading, CalendarNext, CalendarGrid, CalendarWeekdays, CalendarWeekday, CalendarRow, CalendarDay,} from '@proto.ui/prototypes-shadcn/calendar';
export function ExampleCalendar() { return ( <CalendarRoot styleProfile="rhea" mode="single" defaultMonth="2026-10" defaultValue="2026-10-12" today="2026-10-08" className="rounded-lg border border-border" > <CalendarCaption> <CalendarPrevious a11yLabel="Previous month" /> <CalendarHeading /> <CalendarNext a11yLabel="Next month" /> </CalendarCaption> <CalendarGrid> <CalendarWeekdays> {Array.from({ length: 7 }, (_, offset) => ( <CalendarWeekday key={offset} offset={offset} /> ))} </CalendarWeekdays> {Array.from({ length: 6 }, (_, row) => ( <CalendarRow key={row} index={row}> {Array.from({ length: 7 }, (_, col) => ( <CalendarDay key={col} offset={row * 7 + col} /> ))} </CalendarRow> ))} </CalendarGrid> </CalendarRoot> );}Anatomy and keyboard navigation
Section titled “Anatomy and keyboard navigation”- Compose
Calendarfrom ten parts:Root,Caption,Heading,Previous,Next,Grid,Weekdays,Weekday,Row, andDay. - By default,
Calendarrenders the minimum 4–6 complete weeks for the visible month; passfixedWeeks={true}to always show six rows. Unused rows and cells hide automatically off the focus path. - Arrow keys navigate continuously across months,
Home/Endjump to week boundaries, andPageUp/PageDownmove by month (Shiftby year).direction="rtl"mirrors Left/Right arrows automatically. Calendarnever reads the system clock directly: pass a client-resolvedYYYY-MM-DDtodaystring to mark the current date (aria-current="date") without SSR timezone hydration drift.- Pair with
Date Pickerto build a popover date input, or connect familySelectdropdowns to the caption usingbindCalendarCaption(source, { month, year })(and calldispose()on cleanup).
Selection modes
Section titled “Selection modes”| Mode | Controlled / initial value | Change event |
|---|---|---|
single | value / defaultValue: YYYY-MM-DD | onValueChange({ value }) |
multiple | values / defaultValues: readonly string[] | onValuesChange({ values }) |
range | range / defaultRange: { from?, to? } | onRangeChange({ range }) |
Examples
Section titled “Examples”A single-date calendar with the default month heading.
<proto-ui-shadcn-calendar-root
id="calendar-basic"
class="rounded-lg border border-border"
>
<proto-ui-shadcn-calendar-caption>
<proto-ui-shadcn-calendar-previous aria-label="Previous month">
‹
</proto-ui-shadcn-calendar-previous>
<proto-ui-shadcn-calendar-heading></proto-ui-shadcn-calendar-heading>
<proto-ui-shadcn-calendar-next aria-label="Next month">
›
</proto-ui-shadcn-calendar-next>
</proto-ui-shadcn-calendar-caption>
<proto-ui-shadcn-calendar-grid>
<proto-ui-shadcn-calendar-weekdays>
<!-- 7 Weekday slots with offset 0..6 -->
</proto-ui-shadcn-calendar-weekdays>
<!-- 6 Row slots (index 0..5), each with 7 Day slots (offset 0..41) -->
</proto-ui-shadcn-calendar-grid>
</proto-ui-shadcn-calendar-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#calendar-basic'), {
styleProfile: 'rhea',
mode: 'single',
defaultMonth: '2026-10',
defaultValue: '2026-10-12',
today: '2026-10-08',
});
</script>Set mode="range" for continuous range selection with joined endpoint corners and middle-span shading.
<proto-ui-shadcn-calendar-root
id="calendar-range"
class="rounded-lg border border-border"
>
<proto-ui-shadcn-calendar-caption>
<proto-ui-shadcn-calendar-previous aria-label="Previous month">
‹
</proto-ui-shadcn-calendar-previous>
<proto-ui-shadcn-calendar-heading></proto-ui-shadcn-calendar-heading>
<proto-ui-shadcn-calendar-next aria-label="Next month">
›
</proto-ui-shadcn-calendar-next>
</proto-ui-shadcn-calendar-caption>
<proto-ui-shadcn-calendar-grid>
<proto-ui-shadcn-calendar-weekdays>
<!-- 7 Weekday slots with offset 0..6 -->
</proto-ui-shadcn-calendar-weekdays>
<!-- 6 Row slots (index 0..5), each with 7 Day slots (offset 0..41) -->
</proto-ui-shadcn-calendar-grid>
</proto-ui-shadcn-calendar-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#calendar-range'), {
styleProfile: 'rhea',
mode: 'range',
defaultMonth: '2026-10',
defaultRange: { from: '2026-10-08', to: '2026-10-16' },
today: '2026-10-04',
});
</script>Multiple and range selection
Section titled “Multiple and range selection”Combine min, max, unavailable, minNights, maxNights, and maxSelected to constrain selectable dates and spans.
<div class="flex flex-wrap items-start gap-8">
<proto-ui-shadcn-calendar-root
id="calendar-range-constrained"
class="rounded-lg border border-border"
>
<!-- Range (1–14 nights) -->
</proto-ui-shadcn-calendar-root>
<proto-ui-shadcn-calendar-root
id="calendar-multiple"
class="rounded-lg border border-border"
>
<!-- Multiple (max 4 dates) -->
</proto-ui-shadcn-calendar-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#calendar-range-constrained'),
{
styleProfile: 'rhea',
mode: 'range',
defaultMonth: '2026-10',
defaultRange: { from: '2026-10-10', to: '2026-10-14' },
min: '2026-10-01',
max: '2026-11-30',
unavailable: ['2026-10-18'],
minNights: 1,
maxNights: 14,
}
);
setElementProps(document.querySelector('#calendar-multiple'), {
styleProfile: 'rhea',
mode: 'multiple',
defaultMonth: '2026-10',
defaultValues: ['2026-10-03', '2026-10-08', '2026-10-12'],
min: '2026-10-01',
max: '2026-11-30',
unavailable: ['2026-10-18'],
maxSelected: 4,
});
</script>Presets
Section titled “Presets”Pair controlled value, month, and fixedWeeks with family Button actions for quick date jumps.
<div class="inline-flex flex-col items-center gap-3">
<proto-ui-shadcn-calendar-root
id="calendar-presets"
class="rounded-lg border border-border"
>
<!-- Caption + 6-week fixed Grid -->
</proto-ui-shadcn-calendar-root>
<div class="flex max-w-[300px] flex-wrap gap-2">
<proto-ui-shadcn-button data-offset="0">
Today
</proto-ui-shadcn-button>
<proto-ui-shadcn-button data-offset="1">
Tomorrow
</proto-ui-shadcn-button>
<proto-ui-shadcn-button data-offset="3">
In 3 days
</proto-ui-shadcn-button>
<proto-ui-shadcn-button data-offset="7">
In a week
</proto-ui-shadcn-button>
<proto-ui-shadcn-button data-offset="14">
In 2 weeks
</proto-ui-shadcn-button>
</div>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector('#calendar-presets');
setElementProps(root, {
styleProfile: 'rhea',
fixedWeeks: true,
value: '2026-10-12',
month: '2026-10',
today: '2026-10-10',
});
</script>Booked dates
Section titled “Booked dates”Use unavailable along with min and max to block booked date ranges.
<proto-ui-shadcn-calendar-root
id="calendar-booked"
class="rounded-lg border border-border"
>
<!-- Caption + Grid -->
</proto-ui-shadcn-calendar-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#calendar-booked'), {
styleProfile: 'rhea',
defaultMonth: '2026-10',
defaultValue: '2026-10-06',
today: '2026-10-06',
min: '2026-10-01',
max: '2026-10-31',
unavailable: [
'2026-10-12',
'2026-10-13',
'2026-10-14',
'2026-10-15',
'2026-10-16',
'2026-10-17',
'2026-10-18',
'2026-10-19',
'2026-10-20',
],
});
</script>Set direction="rtl", locale="ar-SA", and weekStartsOn={6} for right-to-left Arabic rendering and mirrored arrow navigation.
<proto-ui-shadcn-calendar-root
id="calendar-rtl"
class="rounded-lg border border-border"
>
<!-- Caption + Grid -->
</proto-ui-shadcn-calendar-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#calendar-rtl'), {
styleProfile: 'rhea',
defaultMonth: '2026-10',
defaultValue: '2026-10-12',
today: '2026-10-08',
locale: 'ar-SA',
direction: 'rtl',
weekStartsOn: 6,
a11yLabel: 'اختر تاريخاً',
});
</script>| Prop | Type | Default |
|---|---|---|
mode | 'single' 'multiple' 'range' | 'single' |
value | string | undefined |
defaultValue | string | '' |
values | readonly string[] | undefined |
defaultValues | readonly string[] | [] |
range | CalendarRange | undefined |
defaultRange | CalendarRange | {} |
minSelected | number | 0 |
maxSelected | number | undefined |
minNights | number | 0 |
maxNights | number | undefined |
month | string | undefined |
defaultMonth | string | undefined |
min | string | '' |
max | string | '' |
unavailable | readonly string[] | [] |
disabled | boolean | false |
readOnly | boolean | false |
weekStartsOn | number | 0 |
fixedWeeks | boolean | false |
a11yLabel | string | 'Calendar' |
today | string | '' |
locale | string | 'en-US' |
direction | 'ltr' 'rtl' | 'ltr' |
styleProfile | 'vega' 'nova' 'maia' 'lyra' 'mira' 'luma' 'sera' 'rhea' 'new-york-v4' | 'nova' |
Sub-part props
Section titled “Sub-part props”| Part / Prop | Type | Default |
|---|---|---|
Day.date | string | '' |
Day.offset | number | 0 |
Day.disabled | boolean | false |
Row.index | number | undefined |
Weekday.offset | number | 0 |
Caption.a11yLabel | string | 'Calendar navigation' |
Previous / Next.a11yLabel | string | 'Previous month' / 'Next month' |
Previous / Next.buttonVariant | 'ghost' 'outline' | 'ghost' |
Previous / Next.disabled | boolean | false |
Events, methods, and exposed states
Section titled “Events, methods, and exposed states”- Events (Root):
onValueChange({ value }),onValuesChange({ values }),onRangeChange({ range }),onMonthChange({ month }). - Methods (Root):
requestValue(date),requestValues(dates),requestRange(range),requestMonth(month),getValues(),getRange(). - Exposed states: Root exposes
value,mode,selectedCount,rangeComplete,month,weekCount,disabled,direction; Day exposesdate,selected,rangeStart,rangeEnd,rangeMiddle,rangePending,today,outside,disabled,hidden.