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

Function Calendar

starters/docs/src/Calendar.tsx:21–48  ·  view source on GitHub ↗
({errorMessage, ...props}: CalendarProps<T>)

Source from the content-addressed store, hash-verified

19}
20
21export function Calendar<T extends DateValue>({errorMessage, ...props}: CalendarProps<T>) {
22 let months = props.visibleDuration?.months || 1;
23 return (
24 <AriaCalendar {...props}>
25 <div className="months">
26 {Array.from({length: months}, (_, i) => (
27 <div key={i} className="month">
28 <header>
29 {i === 0 && (
30 <Button slot="previous" variant="quiet">
31 <ChevronLeft />
32 </Button>
33 )}
34 <CalendarHeading offset={{months: i}} />
35 {i === months - 1 && (
36 <Button slot="next" variant="quiet">
37 <ChevronRight />
38 </Button>
39 )}
40 </header>
41 <CalendarGrid offset={{months: i}}>{date => <CalendarCell date={date} />}</CalendarGrid>
42 </div>
43 ))}
44 </div>
45 {errorMessage && <Text slot="errorMessage">{errorMessage}</Text>}
46 </AriaCalendar>
47 );
48}
49
50export function CalendarCell(props: CalendarCellProps) {
51 return (

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected