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
Month Overflow
Week
Day Free
Day Blocked
Dim
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
| Variant | What it is |
|---|---|
| month | Date, count, up to 3 small chips, "+N more". |
| week | Column with up to 6 chips. |
| day | Time row with chips, blocked time or a free slot. |
| today | 2px primary ring and filled date. |
| dim | Days outside the month. |
| blocked | Striped 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
| Prop | Type | Default | Description |
|---|---|---|---|
view | CalendarCellView | 'month' | 'month' | 'week' | 'day' |
date | string | number | — | Day number or label ("Thu 9"); required for month and week |
time | string | — | Row time ("9:20 AM"); required for day |
appointments | AppointmentChipProps[] | [] | AppointmentChip props[] |
count | number | none | Appointment count shown in the month header |
today | boolean | false | Highlights today |
dim | boolean | false | Day outside the current month |
blocked | string | none | Reason the time is blocked ("Lunch", "CME conference") |
label | string | none | aria-label of the cell (month and week) |
onBook | (time: string | undefined) => void | none | Called with `time` when the free slot of a day row is chosen |
onMore | () => void | none | Called 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>
| Kind | Name | Description |
|---|---|---|
| attribute | view | 'month' | 'week' | 'day'; default 'month' |
| property / JSON attribute | date | Day number or label ("Thu 9"); required for month and week |
| attribute | time | Row time ("9:20 AM"); required for day |
| property / JSON attribute | appointments | AppointmentChip props[]; default [] |
| attribute | count | Appointment count shown in the month header; default none |
| attribute | today | Highlights today; default false |
| attribute | dim | Day outside the current month; default false |
| attribute | blocked | Reason the time is blocked ("Lunch", "CME conference"); default none |
| attribute | label | aria-label of the cell (month and week); default none |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-book | Called with `time` when the free slot of a day row is chosen; default none (React: onBook) |
| event | co-more | Called when "+N more" is chosen in a month or week cell; default none (React: onMore) |