MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Calendar

Function Calendar

starters/hooks/src/Calendar.tsx:21–46  ·  view source on GitHub ↗
(props: AriaCalendarProps<DateValue>)

Source from the content-addressed store, hash-verified

19import './Calendar.css';
20
21export function Calendar(props: AriaCalendarProps<DateValue>) {
22 let {locale} = useLocale();
23 let state = useCalendarState({...props, locale, createCalendar});
24 /*- begin highlight -*/
25 let {calendarProps, prevButtonProps, nextButtonProps, title} = useCalendar(props, state);
26 /*- end highlight -*/
27
28 return (
29 <div {...calendarProps} className="react-aria-Calendar">
30 <header>
31 <Button {...prevButtonProps} variant="quiet">
32 <ChevronLeft size={18} />
33 </Button>
34 <h2 className="react-aria-CalendarHeading">{title}</h2>
35 <Button {...nextButtonProps} variant="quiet">
36 <ChevronRight size={18} />
37 </Button>
38 </header>
39 <div className="months">
40 <div className="month">
41 <CalendarGrid state={state} />
42 </div>
43 </div>
44 </div>
45 );
46}
47
48function CalendarGrid({state, ...props}: AriaCalendarGridProps & {state: CalendarState}) {
49 let {gridProps, headerProps, weekDays, weeksInMonth} = useCalendarGrid(props, state);

Callers

nothing calls this directly

Calls 3

useLocaleFunction · 0.90
useCalendarStateFunction · 0.90
useCalendarFunction · 0.90

Tested by

no test coverage detected