Skip to main content

CalendarCell

ComplexScheduling<co-calendar-cell>

CalendarCell renders one cell of the month, week or day calendar with its appointments, blocked time and free slots.

import { CalendarCell } from 'health-components';

Examples​

Showcase​

Storybook

Month Overflow​

Storybook

Week​

Storybook

Day Free​

Storybook

Day Blocked​

Storybook

Dim​

Storybook

Usage​

<CalendarCell view="month" date={9} today count={14} appointments={dayAppts} />
<CalendarCell view="day" time="12:00 PM" blocked="Lunch" />

When to use​

  • Building the schedule views.

When not to use​

  • A small date picker: DatePicker.

Variants and states​

VariantWhat it is
monthDate, count, up to 3 small chips, "+N more".
weekColumn with up to 6 chips.
dayTime row with chips, blocked time or a free slot.
today2px primary ring and filled date.
dimDays outside the month.
blockedStriped block with reason (Lunch, Admin time).

Accessibility​

  • gridcell role; the free slot link says "+ Book 10:20 AM" on focus.

Do and don't​

  • Do: Put the reason on blocked time.
  • Don't: Squeeze more than 3 chips into a month cell.

Props​

PropTypeDefaultDescription
viewCalendarCellView'month''month' | 'week' | 'day'
datestring | number—Day number or label ("Thu 9"); required for month and week
timestring—Row time ("9:20 AM"); required for day
appointmentsAppointmentChipProps[][]AppointmentChip props[]
countnumbernoneAppointment count shown in the month header
todaybooleanfalseHighlights today
dimbooleanfalseDay outside the current month
blockedstringnoneReason the time is blocked ("Lunch", "CME conference")
labelstringnonearia-label of the cell (month and week)
onBook(time: string | undefined) => voidnoneCalled with `time` when the free slot of a day row is chosen
onMore() => voidnoneCalled when "+N more" is chosen in a month or week cell

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-calendar-cell>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-calendar-cell view="…" time="…" [date]="date" (co-book)="onBook($event.detail)"></co-calendar-cell>
KindNameDescription
attributeview'month' | 'week' | 'day'; default 'month'
property / JSON attributedateDay number or label ("Thu 9"); required for month and week
attributetimeRow time ("9:20 AM"); required for day
property / JSON attributeappointmentsAppointmentChip props[]; default []
attributecountAppointment count shown in the month header; default none
attributetodayHighlights today; default false
attributedimDay outside the current month; default false
attributeblockedReason the time is blocked ("Lunch", "CME conference"); default none
attributelabelaria-label of the cell (month and week); default none
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-bookCalled with `time` when the free slot of a day row is chosen; default none (React: onBook)
eventco-moreCalled when "+N more" is chosen in a month or week cell; default none (React: onMore)