Data

Resource scheduler.

Plan resource lanes with explicit instants and reviewed scheduling changes.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/resource-scheduler.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Move a resource booking with a way back

People, rooms and equipment share explicit availability. Pointer and keyboard proposals use one reviewed, revision-checked save.

Keyboard

  • Arrow keys move an event proposal; Up and Down change resource. Shift resizes the end; Control or Command resizes the start.
  • Enter opens the review dialog. Its day/time choices are existing UTC instants displayed with their IANA offsets.
  • Pointer movement and resizing only preview a change. Escape or pointer cancellation restores the prior draft.
  • An unknown save result locks the unchanged request for retry; a revision conflict requires explicit rebase.

States covered

  • resource lanes
  • day and week
  • snapped pointer proposals
  • keyboard resize
  • exact table
  • mobile agenda
  • availability and overlap
  • lost acknowledgement
  • conflict rebase
  • late response

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-resource-scheduler-recovery.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import { useCallback, useRef, useState } from 'react';
import { Button, ResourceScheduler, Select, createMemoryResourceScheduler, type SchedulerChange, type SchedulerDay, type SchedulerSaveContext, type SchedulerSaveResult, type SchedulerSnapshot } from '@bld8/ui';

const dates=['2026-11-16','2026-11-17','2026-11-18'];
const days:SchedulerDay[]=dates.map(date=>({date,start:date+'T09:00:00.000Z',end:date+'T17:00:00.000Z'}));
const initial:SchedulerSnapshot={revision:1,resources:[{id:'alex',label:'Alex Morgan',kind:'person'},{id:'room',label:'Review room',kind:'room'},{id:'kit',label:'Device kit',kind:'resource'}],availability:dates.flatMap(date=>['alex','room','kit'].map(resourceId=>({id:resourceId+'-'+date,resourceId,start:date+'T09:00:00.000Z',end:date+'T17:00:00.000Z'}))),events:[
  {id:'review',resourceId:'alex',title:'Interface review',start:'2026-11-16T09:00:00.000Z',end:'2026-11-16T10:00:00.000Z',revision:1},
  {id:'sync',resourceId:'alex',title:'Design sync',start:'2026-11-16T11:00:00.000Z',end:'2026-11-16T12:00:00.000Z',revision:1},
  {id:'room-review',resourceId:'room',title:'Room booking',start:'2026-11-16T10:00:00.000Z',end:'2026-11-16T11:00:00.000Z',revision:1},
  {id:'device-check',resourceId:'kit',title:'Device check',start:'2026-11-17T13:00:00.000Z',end:'2026-11-17T14:00:00.000Z',revision:1}
]};
function wait(signal:AbortSignal,milliseconds:number){return new Promise<void>((resolve,reject)=>{const timer=setTimeout(done,milliseconds);function stop(){clearTimeout(timer);reject(new DOMException('Aborted','AbortError'));}function done(){signal.removeEventListener('abort',stop);resolve();}if(signal.aborted){stop();return;}signal.addEventListener('abort',stop,{once:true});});}
export default function ResourceSchedulerRecoveryExample(){
  const service=useRef(createMemoryResourceScheduler(initial)),mode=useRef('normal'),lost=useRef(false),conflicted=useRef(false);
  const [snapshot,setSnapshot]=useState(initial),[preview,setPreview]=useState('normal'),[key,setKey]=useState(0),[ids,setIds]=useState<string[]>([]);
  const save=useCallback(async(change:SchedulerChange,context:SchedulerSaveContext):Promise<SchedulerSaveResult>=>{
    const active=service.current,scenario=mode.current;setIds(current=>[...current,context.requestId]);
    if(scenario==='late'){await new Promise(resolve=>setTimeout(resolve,600));return active.save(change,{...context,signal:new AbortController().signal});}
    await wait(context.signal,120);
    if(scenario==='reject')return {ok:false,code:'validation',message:'Example service rejected this change. Your proposal is kept.'};
    if(scenario==='conflict'&&!conflicted.current){conflicted.current=true;const current=active.read(),event=current.events.find(event=>event.id===change.eventId)!;await active.save({eventId:event.id,expectedRevision:event.revision,expectedSnapshotRevision:current.revision,resourceId:event.resourceId,start:new Date(Date.parse(event.start)+30*60000).toISOString(),end:new Date(Date.parse(event.end)+30*60000).toISOString()},{signal:new AbortController().signal,requestId:crypto.randomUUID()});}
    const result=await active.save(change,context);
    if(scenario==='lost'&&!lost.current){lost.current=true;throw new Error('The acknowledgement was lost after the example write.');}
    return result;
  },[]);
  return <div style={{minWidth:0,display:'grid',gap:16}}>
    <div style={{display:'flex',alignItems:'end',gap:12,flexWrap:'wrap'}}><Select label="Scheduler service preview" value={preview} options={[{value:'normal',label:'Successful save'},{value:'lost',label:'Lost acknowledgement'},{value:'conflict',label:'Newer revision'},{value:'reject',label:'Rejected save'},{value:'late',label:'Late service response'},{value:'readonly',label:'Read only'}]} onValueChange={value=>{if(value){mode.current=value;setPreview(value);}}}/><Button variant="secondary" size="sm" onClick={()=>{service.current=createMemoryResourceScheduler(initial);lost.current=false;conflicted.current=false;setSnapshot(initial);setIds([]);setKey(value=>value+1);}}>Reset scheduler source</Button><Button size="sm" variant="secondary" onClick={async()=>{const current=service.current.read(),event=current.events.find(event=>event.id==='sync')!;const result=await service.current.save({eventId:event.id,expectedRevision:event.revision,expectedSnapshotRevision:current.revision,resourceId:event.resourceId,start:new Date(Date.parse(event.start)+15*60000).toISOString(),end:new Date(Date.parse(event.end)+15*60000).toISOString()},{signal:new AbortController().signal,requestId:crypto.randomUUID()});if(result.ok)setSnapshot(result.snapshot);}}>Publish newer supplied schedule</Button></div>
    <ResourceScheduler label="Resource planning" snapshot={snapshot} days={days} timeZone="UTC" onSave={save} onSnapshotChange={setSnapshot} sourceKey={key} snapMinutes={15} readOnly={preview==='readonly'}/>
    <output aria-label="Scheduler save request IDs" style={{fontSize:11,overflowWrap:'anywhere'}}>{JSON.stringify(ids)}</output>
    <p className="bui-hint">Authored events and availability. The single-process example stores at most 100 receipts and resets on reload. A real service must authorise resource access, check revisions and overlap atomically, and retain durable idempotency receipts. Stopping a client request cannot prove a server write was undone.</p>
  </div>;
}

Two occurrences of the same local hour

A supplied UTC window spans a clock change. Offset labels distinguish repeated local times without converting an ambiguous wall clock.

Keyboard

  • Both 01:00 choices keep different UTC values and UTC offsets.
  • Use Exact table to inspect the canonical instants and revisions.
  • Changing reading direction reverses logical pointer and horizontal keyboard movement without changing event values.

States covered

  • IANA zone
  • repeated local hour
  • explicit UTC boundaries
  • scoped right-to-left
  • canonical instants
  • controlled host save

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-resource-scheduler-repeated-hour.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import { useCallback, useRef, useState } from 'react';
import { Button, ResourceScheduler, UIProvider, createMemoryResourceScheduler, type SchedulerChange, type SchedulerSaveContext, type SchedulerSnapshot } from '@bld8/ui';

const initial:SchedulerSnapshot={revision:1,resources:[{id:'room',label:'Review room',kind:'room'}],availability:[{id:'window',resourceId:'room',start:'2026-11-01T04:00:00.000Z',end:'2026-11-01T08:00:00.000Z'}],events:[{id:'first-hour',resourceId:'room',title:'First local hour',start:'2026-11-01T05:00:00.000Z',end:'2026-11-01T05:30:00.000Z',revision:1},{id:'second-hour',resourceId:'room',title:'Second local hour',start:'2026-11-01T06:00:00.000Z',end:'2026-11-01T06:30:00.000Z',revision:1}]};
const days=[{date:'2026-11-01',start:'2026-11-01T04:00:00.000Z',end:'2026-11-01T08:00:00.000Z'}];
export default function RepeatedLocalHourExample(){
  const service=useRef(createMemoryResourceScheduler(initial)),[snapshot,setSnapshot]=useState(initial),[rtl,setRtl]=useState(false);
  const save=useCallback((change:SchedulerChange,context:SchedulerSaveContext)=>service.current.save(change,context),[]);
  return <UIProvider direction={rtl?'rtl':'ltr'} locale="en-AU"><div style={{minWidth:0,display:'grid',gap:16}}><Button variant="secondary" size="sm" onClick={()=>setRtl(value=>!value)}>{rtl?'Use left-to-right':'Use right-to-left'}</Button><ResourceScheduler label="Repeated-hour planning" snapshot={snapshot} days={days} timeZone="America/New_York" onSave={save} onSnapshotChange={setSnapshot}/><p className="bui-hint">These are authored UTC instants. The display projects them into New York; no local date/time string is resolved into an instant.</p></div></UIProvider>;
}

Quick reference

React / TypeScript
<ResourceScheduler label="Rooms" snapshot={snapshot} days={days} timeZone="Australia/Melbourne" />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Day/week resource lanes provide drag/resize previews, keyboard/dialog alternatives and exact agenda/table views. Host-supplied UTC day boundaries preserve repeated-hour distinctions. Availability, overlap and revisions are validated before explicit saves; the host owns permissions, durable idempotency and persistence.

ResourceScheduler

ResourceScheduler public properties
PropTypeDefault
daysRequiredreadonly SchedulerDay[]

Explicit UTC day boundaries supplied by the host for this display zone.

—
labelRequiredstring—
snapshotRequiredSchedulerSnapshot—
timeZoneRequiredstring—
classNamestring | undefined—
defaultView"day" | "week" | undefined'day'
onSave((change: SchedulerChange, context: SchedulerSaveContext) => Promise<SchedulerSaveResult>) | undefined—
onSnapshotChange((snapshot: SchedulerSnapshot) => void) | undefined—
readOnlyboolean | undefinedfalse
snapMinutes5 | 10 | 15 | 30 | 60 | undefined15
sourceKeystring | number | undefined—

ResourceSchedulerProps

ResourceSchedulerProps public properties
PropTypeDefault
daysRequiredreadonly SchedulerDay[]

Explicit UTC day boundaries supplied by the host for this display zone.

—
labelRequiredstring—
snapshotRequiredSchedulerSnapshot—
timeZoneRequiredstring—
classNamestring | undefined—
defaultView"day" | "week" | undefined—
onSave((change: SchedulerChange, context: SchedulerSaveContext) => Promise<SchedulerSaveResult>) | undefined—
onSnapshotChange((snapshot: SchedulerSnapshot) => void) | undefined—
readOnlyboolean | undefined—
snapMinutes5 | 10 | 15 | 30 | 60 | undefined—
sourceKeystring | number | undefined—

SchedulerSnapshot

SchedulerSnapshot public properties
PropTypeDefault
availabilityRequiredSchedulerAvailability[]—
eventsRequiredSchedulerEvent[]—
resourcesRequiredSchedulerResource[]—
revisionRequirednumber—

SchedulerEvent

SchedulerEvent public properties
PropTypeDefault
endRequiredstring—
idRequiredstring—
resourceIdRequiredstring—
revisionRequirednumber—
startRequiredstring—
titleRequiredstring—

SchedulerResource

SchedulerResource public properties
PropTypeDefault
idRequiredstring—
labelRequiredstring—
kind"person" | "room" | "resource" | undefined—

SchedulerDay

SchedulerDay public properties
PropTypeDefault
dateRequiredstring—
endRequiredstring—
startRequiredstring—

SchedulerChange

SchedulerChange public properties
PropTypeDefault
endRequiredstring—
eventIdRequiredstring—
expectedRevisionRequirednumber—
expectedSnapshotRevisionRequirednumber—
resourceIdRequiredstring—
startRequiredstring—

SchedulerSaveResult

{ok:true;requestId:string;eventId:string;snapshot:SchedulerSnapshot}|{ok:false;code:'conflict';snapshot:SchedulerSnapshot}|{ok:false;code:'validation';message:string}

SchedulerSaveResult public properties
PropTypeDefault
okRequiredboolean—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.