Skip to the content

Calendar

An inline date grid: react-day-picker (opens in a new tab) dressed with Apollion tokens. It does no positioning, popover or trigger — for a date field, use InputDate, which wraps the Calendar in a popover.
Data Display

When to use

Use when
  • Inline date selection with no popover: dashboard filters, scheduling inside a form.
  • A date range with more than one month visible.
  • You build your own modal or popover around the grid.
Avoid when
  • A date field in a regular form — use InputDate.
  • Only a month or a year is needed — the grid always picks a day.

Usage

Selected: 5/15/2026

maio 2026
import { Calendar } from '@apollion-dsi/core/elements/calendar';

const [date, setDate] = useState();
<Calendar mode="single" selected={date} onSelect={setDate} />;

Calendar takes the react-day-picker props (DayPickerProps); mode (single, multiple, range) types selected and onSelect. Do not pass className, classNames, style or styles: the DS wrapper overrides them.

Range

Select a range

maio 2026
junho 2026
<Calendar mode="range" selected={range} onSelect={setRange} numberOfMonths={2} />

Year navigation

captionLayout="dropdown" replaces the month caption with month and year dropdowns; startMonth and endMonth bound the years.

captionLayout="dropdown" enables month + year dropdowns in the header — useful for distant dates.

<Calendar
  mode="single"
  selected={date}
  onSelect={setDate}
  captionLayout="dropdown"
  startMonth={new Date(1970, 0)}
  endMonth={new Date(2100, 11)}
/>

Locale and disabled dates

The locale defaults to ptBR from date-fns/locale; pass any other date-fns locale. disabled takes the react-day-picker Matcher syntax: a date, a range, a predicate or an array.

Weekends and days before 05/15 are disabled.

maio 2026
import { enUS } from 'date-fns/locale';

<Calendar mode="single" locale={enUS} disabled={[{ before: new Date() }, { dayOfWeek: [0, 6] }]} />;

Accessibility

  • Keyboard navigation and the grid semantics come from react-day-picker.
  • A focused day shows a visible :focus-visible outline, kept in forced-colors (high contrast) mode.
  • Set locale to the page language so day and month names are announced correctly.

See also