Week, day or resource time grid: events are pills that stretch from capsule to tile when resized, lift in the hand and land with a squash.
DragDrag
Support shifts
Support team
Press Enter or Space to pick up the event. Arrow keys move it by 15 minutes or one column, Shift with Up or Down changes its end, Enter drops it, Escape cancels.
Use it for anything placed on hours that people move or resize: shifts, bookings, meetings. It can refuse overlaps, mark unavailable time and wait for an async save.
Use it for anything placed on hours: support shifts, room bookings, meetings, maintenance windows,
a nurse rota. Events are pills with a fixed 12 px radius, so a 30 minute event is a capsule and a
longer one a tile. Hovering shows a 20 × 4 grip at each end; dragging an end stretches the pill on
the 15 minute step while the other edge stays, and its time rolls. Pressing the middle sinks the
event; past 4 px it lifts into a layer above the page, leans toward where the hand is going, and its
slot (a muted tile of the same size) travels ahead snapping to day and step. On release it flies
into the slot and squashes onto the hour line, and both times roll. Dragging on empty grid draws a
new pill that opens its title field on release.
The grid can also say no. unavailable ranges are hatched bands (time off, cleaning, a booked
room); allowOverlap={false} refuses a slot that overlaps another event; canChange is your own
veto. While dragging over a refused slot the slot turns destructive and a reason pill grows from
its corner ("Mira off", "Overlaps Shift B") before you let go; dropping there sends the event home.
When onEventChange returns a promise, the event waits in its new slot with a breathing dot and,
if the save fails, lifts by itself and flies back with the reason. For picking a single date use the date picker; for
a month overview a calendar month view (not included: this is a time grid).
Uncontrolled schedulers take defaultEvents. Dates are local Dates, formatted with Intl
(locale, default en-US); no date library. preset picks the layout (week, day with
64 px hours, descriptions and the day switcher, resources with one column per person or room)
and view, hourHeight override it. startHour, endHour, step and weekStartsOn shape the
grid. renderEvent replaces the event body while keeping the shell (surface, grips, lift, slot,
put-down). actionsRef exposes moveEvent(id, start, resourceId?), which plays the whole trip.
temperament only changes the intensity of the motion: the scheduler looks the same in all three.
navigation adds the range with Today, Previous and Next above the grid (a week at a time in the
week view, a day otherwise); it moves the shown date by itself and reports it through
onDateChange, and a new date prop takes over again.
<CalendarScheduler events={events} allowOverlap={false} unavailable={[ { start: new Date(2026, 9, 22, 17), end: new Date(2026, 9, 22, 19), label: "Mira off" }, ]} canChange={(change) => (change.start.getDay() === 0 ? "Closed on Sundays" : true)} onEventChange={async (change) => { const res = await fetch(`/api/shifts/${change.id}`, { method: "PATCH", body: JSON.stringify(change), }) if (!res.ok) throw new Error("Shift is full") setEvents((list) => list.map((e) => (e.id === change.id ? { ...e, ...change } : e))) }}/>
canChange returns true or a reason. It runs for every slot a drag visits, so keep it fast; a
promise it returns is awaited only after the drop. onEventChange may return a promise: resolving
to false or rejecting (the error's message becomes the reason) flies the event back. Controlled,
update events once the save has succeeded, before the promise resolves. Unavailable ranges sit on
one day (start and end on the same date); in the resources view a resourceId limits a range
to one column. Drawing a new event over a refused range is refused the same way.
One room, one day at a time: taller hours carry the description, the seven day balls above switch
the day and the active ball travels to it. Below 640 px the week preset takes this layout too, on
today.
DragDrag
Room 2 · bookings
Third floor · 8 seats
Press Enter or Space to pick up the event. Arrow keys move it by 15 minutes or one column, Shift with Up or Down changes its end, Enter drops it, Escape cancels.
Columns are people; moving a shift across columns reassigns it (resourceId in onEventChange).
Hours off are hatched per nurse and allowOverlap={false} keeps anyone from being double-booked:
drag Ward B onto Ada's morning and the slot reads "Overlaps Ward A". The training block is locked
and refuses with a destructive rim.
DragDrag
Nurses · Monday
Ward rota · Oct 19
Press Enter or Space to pick up the event. Arrow keys move it by 15 minutes or one column, Shift with Up or Down changes its end, Enter drops it, Escape cancels.
CalendarScheduler (data-slot="calendar-scheduler"): the root group, the polite live region,
the scroller and the portal layer of the lifted event.
SchedulerHeader (data-slot="scheduler-header"): the New event button, the day pills with
today's number in a 28 px primary ball (or resource names with an initials ball).
Hour gutter and grid: hour lines, dashed half hours, one data-cell="thu-11" per hour cell.
SchedulerEvent (data-slot="scheduler-event", data-event="<id>"): a <button> with title,
rolling times and two grips; while dragged it is the slot (data-state="slot"), lifted with the
keyboard (lifted), resizing or refused.
Navigation (data-slot="scheduler-nav", with navigation): the range and the Today, Previous
and Next buttons.
Unavailable band (data-slot="scheduler-unavailable"): a hatched tile with its label.
Reason pill (data-slot="scheduler-reason"): a 24 px pill with a destructive dot, grown from the
refused slot's corner; it retracts when the slot is free again.
Saving dot: a 6 px dot in the event's corner while a promise from onEventChange is pending
(the event is aria-busy and its label ends with "saving").
Now line (data-slot="scheduler-now"): 1 px primary line with an 8 px ball, moved once a minute.
Events are buttons with aria-roledescription="event", a label with title, day and times ("Shift A,
Tue 09:00–12:00", plus "locked") and instructions through aria-describedby. Grabs, moves, resizes,
refusals and creations are announced in an aria-live="polite" region ("Shift A moved to Wed
10:00–11:30"). A refused slot is read with its reason as you move ("Thu 17:00–18:00. Mira off."); a
keyboard drop on it keeps the event in the hand and repeats the reason, a pointer drop sends it home
("Mira off. 1:1 is back at Tue 14:00–15:00"), and a failed save reads its reason the same way. The
reason pill is decorative: the live region carries the words. The New event button (28 px) creates a one hour event at the next free hour of today,
so creation works without a pointer, and focus moves to the new event. The focus ring
(ring-[3px] ring-ring/50) stays on an event lifted with the keyboard. Hour labels are
foreground/70; event text is primary-foreground on primary or foreground on 16% tone tints.
The day switcher is a radio group with arrow keys. Grips are a pointer convenience (12 px hit area)
with Shift+Arrow as their keyboard equivalent; on touch they stay visible.
No lift, lean or put-down squash. The event follows the pointer 1:1 with its shadow; the slot, the
landing and the times crossfade. Resizing still follows the hand, because the hand drives it. The
reason pill fades instead of growing, the saving dot stays still, and an event sent back by a failed
save dissolves into its home slot instead of flying.
Nothing runs at rest except a one-minute timer for the now line. During a drag only the copy's
transform and opacity change per frame; events move with Motion on the calm spring, overlaps are
laid out in lanes once per change. Hit testing reads the grid's box, never animated boxes. On touch a
drag starts after a 300 ms hold, so a swipe still scrolls. Time grid only: no month view, recurrence
or all-day row. Our code (the component plus the shared beats, roll and motion primitives) is about
15 kB gzip; motion is the only npm dependency (a peer, counted apart). Nothing is lazy-loaded.
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, motion.
Dependencies
motion · peer
Triggers
drag, press, a value change, entering the viewport
Reduced motion
No lift, lean or squash: the event follows the pointer 1:1, the slot, landing and times crossfade; resizing follows the hand. The reason pill fades in and a failed save dissolves the event back home.
Keyboard
Tab
Moves between the New event button and the events
Enter / Space
Picks up the focused event (it lifts in place); drops it into its slot, or reads why a refused slot is refused
ArrowUp / ArrowDown
Moves the slot one step (15 min) earlier or later
ArrowLeft / ArrowRight
Moves the slot one day or resource column
Shift + ArrowUp / ArrowDown
Shortens or stretches the event's end by one step (with or without a grab)
Escape
Cancels the drag: the event stays where it was (pointer drags too)
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)