Utilities and hooks
All of these are exported from resource-scheduler. The pure functions among them (and the layout ones that are not on this page, such as layoutEvents and getRowHeights) are also exported without React from resource-scheduler/headless: see the Headless API.
Conflict rules
Section titled “Conflict rules”isPlacementAllowed(event, placement, resources, rules)returnsboolean. The same check the component runs. Works anywhere, so use it before saving on the server.rangesOverlap(aStart, aEnd, bStart, bEnd)returnsboolean. End times are exclusive; a zero-length range is one instant.
Recurring events
Section titled “Recurring events”expandRecurrence(event, from, to)returns the occurrences of one event that touchfromtoto(end exclusive). A plain event comes back as is, or not at all when it is outside the window.expandEvents(events, from, to)expands the recurring events in a list and passes the others through. See Recurring events.splitRecurrence(event, occurrence, edits?)returns{ before, after }for “edit this and following”: the series ended the day before (nullwhenoccurrenceis the first one) and a new series from the occurrence witheditsapplied.editOccurrence(event, occurrence, edits?)returns{ series, changed }for “this occurrence only”: the series with an exception, and a one-off event for that day.
getRowWindow(heights, top, height, overscan?, offset?)returns{ start, end }, the rows worth rendering for a scroll position (endexclusive). What row virtualization uses.
Events
Section titled “Events”withEvents(resources, events?)returnsResource[]. Adds a flat event list to the resources it names, as theeventsprop does. Resources without aneventsarray get an empty one.
Availability
Section titled “Availability”isCellUnavailable(resource, cell, { businessHours, viewType, slotMinutes? })returnsboolean. Whether the slot (day view) or day (other views) starting atcellis shaded for that resource.touchesUnavailable(resource, { start, end }, context)returnsboolean. Whether a placement would touch a shaded cell. This is whatblockUnavailableruns.resolveBusinessHours(hours)returns the hours with the defaults filled in.findAvailableSlots(resource | resources, { from, to, duration, step?, businessHours?, limit? })returns{ start, end }[], the free slots earliest first. With several resources, only times when all are free. See Business hours and availability.suggestResources(resources, request, options?)returns{ resourceId, start, end, score, utilization }[], the resources that can take a job, best first.requestis a fixed time{ start, end }or a window to search{ from, to, duration, step? }, each with an optionalevent(the job).optionsarebusinessHours,resourceIds,eventOverlap,isValidDrop,strategy("earliest","least-booked","most-booked"or a score function),limitandperResource. A placement is suggested only inside the resource’s hours and outside itsunavailabletime, with fewer bookings at once than itscapacity, and when the placement rules accept it. See Suggest who takes a job.
Export
Section titled “Export”Imported from resource-scheduler/exchange, not from the main entry point.
parseRRule(rrule, { start? })reads the value of an iCalendarRRULE(FREQ=MONTHLY;BYDAY=-1FR) as aRecurrence, andtoRRule(recurrence, { start?, allDay? })writes one. Both throw aRangeErrorthat names what they cannot read or write (see Export).icsToEvents(text, { resources?, resourceId?, onWarning? })reads the events of an iCalendar file into scheduler events: UTC,TZID(IANA) and floating times, all-day dates,RRULE/EXDATE, changed occurrences, andLOCATIONmatched toresources(resourceIdfor the rest). Cancelled events are left out, and a rule the scheduler cannot show is imported once with a message toonWarning. See Export and import.eventsToICS(events, { resources?, name?, now? })returns an iCalendar file as a string. Timed events in UTC, whole local days as all-day events,recurrenceasRRULEandexceptionsasEXDATE;resourceswrites the resource name asLOCATION.eventsToCSV(events, { resources? })returnsid,title,resource,start,end,descriptionas a CSV string, one row per resource of an event, with cells that start with=,+,-or@defused against spreadsheet formulas. See Export.
Utilization
Section titled “Utilization”getUtilization(resource, { start, end }, { businessHours? })returns{ bookedMinutes, availableMinutes, ratio }. Booked time inside the available time (business hours minusunavailable, timescapacity) over a range (endexclusive);ratioisnullwhen nothing is available. WhatshowUtilizationdraws. See Utilization.columnUtilization(resources, columns, { businessHours? })adds up the utilization of several resources for each ofcolumns(ranges in order,endexclusive) and returns one{ bookedMinutes, availableMinutes, ratio }per column. WhatshowColumnUtilizationdraws.groupUtilization(resources, { start, end }, { businessHours? })returns aMapfrom a group header’s id ("rs-group:" + the group's key) to the same{ bookedMinutes, availableMinutes, ratio }, summed over every resource below the group, nested ones included. What a group header shows. See Resource groups.
Reordering
Section titled “Reordering”What you apply the reorder callbacks with. Both are pure, return a new array in the order it is shown, and return the array you passed in when nothing would change or a key or id is unknown.
reorderGroup(resources, groupKey, beforeGroupKey)moves a group, with all its resources and nested groups, to just before the sibling groupbeforeGroupKey, or to the end of its siblings when that isnull. A group only moves among the groups with the same parent. Keys are a group’s name, or its path joined with “ / “.moveResource(resources, resourceId, beforeResourceId, group?)moves a resource to just beforebeforeResourceId, or to the end of its group when that isnull.groupis the key of the group it lands in: leave it out to keep its own, passnullfor none. A resource that changes group is copied with itsgroupset to that group’s path; passing its own id asbeforeResourceIdchanges only the group.
Time zones
Section titled “Time zones”The timeZone prop uses these; they are exported for your own conversions. See Time zones.
utcToZoned(date, timeZone)returns aDatewhose local fields (getHours()and so on) are the wall-clock time in the zone at that instant, soformatshows the zone’s time. It is not an instant: convert back before storing it.zonedToUtc(date, timeZone)returns the instant at which a clock in the zone shows the local fields ofdate. A time a clock change skips gets the offset from before it; one that happens twice gets the first.isValidTimeZone(name)says whether the browser knows an IANA zone name.
Dates and slots
Section titled “Dates and slots”getTimeSlots(date, viewType, options?)returns the slots of the day view asDate[].getDatesInView(date, viewType, viewOptions?)returns the days shown.viewOptionsis{ weekStartsOn?, hideWeekends? }.getVisibleRange(date, viewType, options?)returns{ start, end }for what the grid covers (endexclusive).optionstakes the slot and view options.navigateDate(date, viewType, "prev" | "next")resolveSlotOptions(options)returns sanitisedslotMinutes,dayStartHouranddayEndHour, falling back to the defaults for invalid values.getVisibleEvents(events, date, viewType, slotOptions?, viewOptions?)getDropRange(event, slot, viewType),getResizeRange(event, edge, slot, viewType, slotMinutes?)andgetSelectionBounds(a, b, viewType, slotMinutes?): the range arithmetic behind move, resize and select.isSlotInRange(slot, range, viewType, slotMinutes?)formatEventTime(event),formatSlotLabel(slot, viewType)andformatRangeLabel(start, end, viewType): the labels the component uses.scrollToDate(date, viewType, scroller, timeColumnWidth, dateColumnWidth, stickyOffset?, slotOptions?, viewOptions?)
Hooks and parts
Section titled “Hooks and parts”useScheduler,useEventCreation: the state hooks behind the component, for building your own layout.ResourceColumn,SchedulerControls,TimelineHeader,TimelineGrid,EventItem,EmptySlotItem: the building blocks, exported for custom composition. Most apps only needResourceScheduler.useMediaQuery,useIsMobile,useHeadsObserver: small shared hooks.
These lower-level exports follow the same semver as the component, but the component is the supported surface. If you find yourself composing the parts, consider the shadcn install and edit the source instead.