Skip to main content

CalendarPanel

Sidebar companion for <Calendar>. Renders one checkbox per calendar group plus a mini date picker. Reads the calendar-api React context and dispatches filter-events and navigate-to directly to the parent store.

Signature​

import { CalendarPanel } from "@svar-ui/react-calendar";

Designed for the <Calendar> children prop so it can resolve the calendar context.

Props​

PropTypeDefaultDescription
calendarsCalendarGroup[]requiredGroup definitions rendered as checkboxes.
accessorstring"calendarId"Event field used by the generated filter predicate.
openbooleantrueExpanded layout. Hides the mini calendar when false; the checkboxes stay visible.
onChange(detail: { value: (string | number)[]; filter: ((event: Record<string, any>) => boolean) | null }) => voidundefinedFires after a checkbox toggle, including the initial filter when groups start inactive.

CalendarGroup​

FieldTypeRequiredDescription
idstring | numberyesGroup identifier. Compared against event[accessor].
labelstringyesCheckbox label shown in the sidebar.
activebooleannoInitial checked state. Defaults to true. Set false to start hidden.
cssstringnoCSS class added to the group's wrapper element for custom styling.

onChange payload​

FieldTypeDescription
value(string | number)[]Active group ids. Numeric ids come back as strings.
filter((event: Record<string, any>) => boolean) | nullPredicate dispatched to filter-events. null when all groups are on.

Example​

import { Calendar, CalendarPanel } from "@svar-ui/react-calendar";

const calendars = [
{ id: "work", label: "Work" },
{ id: "home", label: "Home" },
{ id: "holiday", label: "Holidays", active: false },
];

<Calendar events={data} view="week" date={date}>
<CalendarPanel calendars={calendars} accessor="calendarId" />
</Calendar>
  • filter-events — action dispatched when a checkbox toggles.
  • navigate-to — action dispatched when the mini date picker selects a date.
  • children — calendar slot where this panel is mounted.
  • Calendar groups — full setup with grouping accessors and styling.