Scheduler
Resource timeline: people, rooms or machines down the side, time across the top, each booking a bar you can drag.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
resources | SchedulerResource[] | [] | The rows: { id, label, group?, description?, avatar?, color? }. Accepts a JSON string as an attribute. |
events | SchedulerEvent[] | [] | The bookings: { id, resource, start, end, title, color?, readonly? }. Accepts a JSON string as an attribute. |
date | string | — | A day of the range shown, YYYY-MM-DD. Defaults to today in time-zone. |
view | SchedulerView | day | day, week or month. |
day-start | string | 00:00 | First hour drawn each day, HH:mm. |
day-end | string | 24:00 | Last hour drawn each day, HH:mm (24:00 for midnight). |
scroll-time | string | 08:00 | Where the day view scrolls to when it is first drawn, HH:mm. |
slot-minutes | number | 60 | Minutes per column in the day view; also the slot the keyboard cursor and a click select. |
snap-minutes | number | 15 | Step, in minutes, that drags and keyboard moves snap to. |
working-hours | string | 09:00-18:00 | Working hours, HH:mm-HH:mm; the day view shades the hours outside them. Empty shades none. |
time-zone | string | — | IANA time zone the current-time line and Today follow, e.g. Europe/Paris. Empty means the browser's own. |
editable | boolean | false | Lets the user create, move and resize bookings; see range-select and event-change. |
bands | SchedulerBand[] | [] | Shaded stretches under the bars: { start, end, label?, color?, resource? }. Accepts a JSON string as an attribute. |
summary-heading | string | — | Header of the summary row. Defaults to "Summary" in the scheduler's language. |
hide-header | boolean | false | Hides the header for an app that drives date and view from its own controls. |
resource-heading | string | — | Header of the resource column. Defaults to "Resources" in the scheduler's language. |
label | string | — | Accessible name of the grid. Defaults to "Schedule" in the scheduler's language. |
locale | string | — | Language of dates and built-in text, e.g. fr or en-GB. Defaults to the nearest lang, else the browser's. |
Events
| Name | Type | Description |
|---|---|---|
range-select | CustomEvent | With editable, a range of empty time was picked by dragging, clicking or Enter. detail: { resource, start, end }. |
event-change | CustomEvent | With editable, a bar was moved or resized. detail: { event, start, end, resource }; apply it to events. |
event-click | CustomEvent | A bar was clicked or activated with Enter or Space. detail: { event }. |
date-change | The header changed the range shown. detail: { date, view, start, end }. | |
view-change | The view switch changed the view. detail: { date, view, start, end }. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
header | The header with the range, navigation and view switch. |
grid | The scrolling grid of resources and time. |
event | Each booking bar. |
summary | The summary row drawn by renderSummary. |
summary-cell | Each cell of the summary row. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-scheduler--background-color | color | #ffffff | Background of the scheduler and its sticky column. |
--c2-scheduler--color | color | #18181b | Text colour. |
--c2-scheduler--border | border | 1px solid #e4e4e7 | Outer border. |
--c2-scheduler--border-radius | pixel | 8px | Outer corner radius. |
--c2-scheduler--max-height | length | none | Height past which the grid scrolls, with sticky headers. |
--c2-scheduler__header--padding | length | 10px 12px | Padding of the header. |
--c2-scheduler__header--font-size | length | 15px | Font size of the range label. |
--c2-scheduler__navigation--border-radius | pixel | 6px | Corner radius of the previous, Today and next buttons. |
--c2-scheduler__navigation__hover--background-color | color | #f4f4f5 | Background of those buttons on hover. |
--c2-scheduler__line--color | color | #e4e4e7 | Grid lines and row separators. |
--c2-scheduler__muted--color | color | #71717a | Scale labels, descriptions and group rows. |
--c2-scheduler__resource--width | length | 180px | Width of the resource column. |
--c2-scheduler__row--height | length | 52px | Least height of a resource row. |
--c2-scheduler__lane--height | length | 24px | Height of each lane when bookings overlap. |
--c2-scheduler__slot--width | length | 88px | Least width of a column in the day view. |
--c2-scheduler__day--width | length | 120px | Least width of a day in the week view. |
--c2-scheduler__month-day--width | length | 44px | Least width of a day in the month view. |
--c2-scheduler__group--background-color | color | #fafafa | Background of group rows. |
--c2-scheduler__off--color | color | color-mix(in srgb, currentColor 7%, transparent) | Stripes over non-working hours and the weekend. |
--c2-scheduler__today--color | color | rgb(2, 101, 220) | Today's header label. |
--c2-scheduler__now--color | color | #dc2626 | The current-time line. |
--c2-scheduler__band--color | color | color-mix(in srgb, currentColor 8%, transparent) | Shade of bands without a colour of their own. |
--c2-scheduler__event--color | color | rgb(2, 101, 220) | Bar colour when neither the booking nor its resource has one. |
--c2-scheduler__event--text-color | color | #18181b | Text on bars. |
--c2-scheduler__event--border-radius | pixel | 6px | Corner radius of bars. |
--c2-scheduler__event--font-size | length | 12px | Font size of bars. |
--c2-scheduler__event__pending--stripe-color | color | color-mix(in srgb, currentColor 16%, transparent) | Hatching over pending bars. |
--c2-scheduler__summary--background-color | color | #fafafa | Background of the summary row. |
--c2-scheduler__avatar--size | length | 28px | Size of resource avatars. |
--c2-scheduler__avatar--color | color | #ffffff | Initials on an avatar drawn in the default event colour (a resource with its own color keeps white). |
--c2-scheduler__focus--outline | outline | 2px solid rgba(2, 101, 220, 0.4) | Focus ring of bars, the slot cursor and buttons. |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under scheduler, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
schedule | Schedule | — |
resources | Resources | — |
view | View | — |
day | Day | — |
week | Week | — |
month | Month | — |
today | Today | — |
previousDay | Previous day | — |
nextDay | Next day | — |
previousWeek | Previous week | — |
nextWeek | Next week | — |
previousMonth | Previous month | — |
nextMonth | Next month | — |
group | {0} · {1} | {0} group {1} count |
range | {0} to {1} | {0} from {1} to |
event | {0}, {1}, {2} | {0} title {1} resource {2} time |
readonly | read-only | — |
pending | pending | — |
slotBands | {0}, {1} | {0} slot {1} labels |
summary | Summary | — |
slot | {0}, {1} | {0} resource {1} time |
slotBookings | {0}, booked: {1} | {0} slot {1} titles |
moved | {0} moved to {1}, {2} | {0} title {1} resource {2} time |
selected | New booking for {0}, {1} | {0} resource {1} time |
cancelled | Move cancelled | — |
now | Now | — |