Data

Gantt.

Plan civil-date tasks, dependencies and reviewed schedule changes.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/gantt.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.

Plan a delivery without moving its dependencies silently

Civil-date task rows, progress and a milestone share reviewed dependency-safe moves and a recoverable host save.

Keyboard

  • Horizontal arrows propose a one-day move; Shift resizes the end, Control or Command resizes the start.
  • Enter opens the review dialog for date, progress and predecessor changes.
  • Pointer movement previews a whole-day move or resize. Escape and pointer cancellation restore the previous proposal.
  • A conflict requires explicit revision rebase; an unknown result retries the unchanged request ID.

States covered

  • day and week scales
  • finish-to-start links
  • cycle validation
  • milestone
  • progress
  • pointer preview
  • keyboard resize
  • exact table
  • mobile list
  • uncertain save
  • conflict

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-gantt-reviewed-delivery.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, Gantt, Select, createMemoryGantt, type GanttChange, type GanttSaveContext, type GanttSaveResult, type GanttSnapshot } from '@bld8/ui';

const initial:GanttSnapshot={revision:1,tasks:[{id:'plan',title:'Interface plan',startDay:'2026-11-16',endDay:'2026-11-18',progress:75,revision:1},{id:'build',title:'Build controls',startDay:'2026-11-20',endDay:'2026-11-23',progress:30,revision:1},{id:'release',title:'Release milestone',startDay:'2026-11-27',endDay:'2026-11-27',milestone:true,progress:0,revision:1}],dependencies:[{from:'plan',to:'build',lagDays:1},{from:'build',to:'release',lagDays:2}]};
const range={startDay:'2026-11-16',endDayExclusive:'2026-11-30'};
function wait(signal:AbortSignal,delay:number){return new Promise<void>((resolve,reject)=>{const timer=setTimeout(done,delay);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 ReviewedDeliveryExample(){
  const service=useRef(createMemoryGantt(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:GanttChange,context:GanttSaveContext):Promise<GanttSaveResult>=>{
    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 task change. The proposal is kept.'};
    if(scenario==='conflict'&&!conflicted.current){conflicted.current=true;const current=active.read(),task=current.tasks.find(task=>task.id===change.taskId)!;await active.save({...change,startDay:task.startDay,endDay:task.endDay,progress:Math.min(100,task.progress+5),expectedRevision:task.revision,expectedSnapshotRevision:current.revision,predecessors:current.dependencies.filter(link=>link.to===task.id).map(link=>({taskId:link.from,lagDays:link.lagDays}))},{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 example write succeeded but its acknowledgement was lost.');}return result;
  },[]);
  return <div style={{display:'grid',gap:16,minWidth:0}}><div style={{display:'flex',alignItems:'end',gap:12,flexWrap:'wrap'}}><Select label="Gantt 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 size="sm" variant="secondary" onClick={()=>{service.current=createMemoryGantt(initial);lost.current=false;conflicted.current=false;setSnapshot(initial);setIds([]);setKey(value=>value+1);}}>Reset task source</Button><Button size="sm" variant="secondary" onClick={async()=>{const current=service.current.read(),task=current.tasks.find(task=>task.id==='build')!;const result=await service.current.save({taskId:task.id,expectedRevision:task.revision,expectedSnapshotRevision:current.revision,startDay:task.startDay,endDay:task.endDay,progress:Math.min(100,task.progress+5),predecessors:current.dependencies.filter(link=>link.to===task.id).map(link=>({taskId:link.from,lagDays:link.lagDays}))},{signal:new AbortController().signal,requestId:crypto.randomUUID()});if(result.ok)setSnapshot(result.snapshot);}}>Publish newer supplied plan</Button></div><Gantt label="Delivery plan" snapshot={snapshot} range={range} onSave={save} onSnapshotChange={setSnapshot} sourceKey={key} readOnly={preview==='readonly'}/><output aria-label="Gantt save request IDs" style={{fontSize:11,overflowWrap:'anywhere'}}>{JSON.stringify(ids)}</output><p className="bui-hint">Authored civil dates and finish-to-start links. End dates are exclusive; a milestone uses one equal start/end date. The single-process example retains 100 receipts and resets on reload. Supply an authorised durable atomic service for an application; a stopped client wait cannot undo a committed task change.</p></div>;
}

Keep civil dates stable in either reading direction

A scoped direction change reverses logical movement while exact dates and dependency checks stay canonical.

Keyboard

  • Switch reading direction before editing; canonical YYYY-MM-DD values remain unchanged.
  • Use Task list or Exact table as an alternative to the dependency timeline.
  • Add and remove predecessors in review. A cycle or a violated finish-to-start interval keeps the invalid draft without saving.

States covered

  • scoped RTL
  • civil date arithmetic
  • predecessor editing
  • cycle rejection
  • exact table
  • controlled memory service

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-gantt-civil-direction.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, Gantt, UIProvider, createMemoryGantt, type GanttChange, type GanttSaveContext, type GanttSnapshot } from '@bld8/ui';

const initial:GanttSnapshot={revision:1,tasks:[{id:'research',title:'Research notes',startDay:'2026-11-16',endDay:'2026-11-18',progress:100,revision:1},{id:'review',title:'Interface review',startDay:'2026-11-20',endDay:'2026-11-23',progress:50,revision:1},{id:'publish',title:'Publish milestone',startDay:'2026-11-27',endDay:'2026-11-27',milestone:true,progress:0,revision:1}],dependencies:[{from:'research',to:'review',lagDays:1},{from:'review',to:'publish',lagDays:1}]};
const range={startDay:'2026-11-16',endDayExclusive:'2026-11-30'};
export default function CivilDirectionExample(){const service=useRef(createMemoryGantt(initial)),[snapshot,setSnapshot]=useState(initial),[rtl,setRtl]=useState(false);const save=useCallback((change:GanttChange,context:GanttSaveContext)=>service.current.save(change,context),[]);return <UIProvider direction={rtl?'rtl':'ltr'} locale="en-AU"><div style={{display:'grid',gap:16,minWidth:0}}><Button variant="secondary" size="sm" onClick={()=>setRtl(value=>!value)}>{rtl?'Use left-to-right':'Use right-to-left'}</Button><Gantt label="Civil delivery dates" snapshot={snapshot} range={range} onSave={save} onSnapshotChange={setSnapshot} defaultScale="week"/><p className="bui-hint">These are civil dates, not UTC schedule instants. This view does not resolve zones, assign resources or cascade dependency changes.</p></div></UIProvider>;}

Quick reference

React / TypeScript
<Gantt label="Delivery plan" snapshot={snapshot} range={range} />

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

Up to 500 tasks and 1,000 finish-to-start links, with bounded visible ranges. Day/week scales, milestones, progress and dependency cycle/lag checks accompany pointer and keyboard/dialog proposals. Changes save only after confirmation with expected revisions and a request ID. No automatic dependency cascade or critical-path service is included.

Gantt

Gantt public properties
PropTypeDefault
labelRequiredstring—
rangeRequiredGanttRange—
snapshotRequiredGanttSnapshot—
classNamestring | undefined—
defaultScale"day" | "week" | undefined'day'
onSave((change: GanttChange, context: GanttSaveContext) => Promise<GanttSaveResult>) | undefined—
onSnapshotChange((snapshot: GanttSnapshot) => void) | undefined—
readOnlyboolean | undefinedfalse
sourceKeystring | number | undefined—

GanttProps

GanttProps public properties
PropTypeDefault
labelRequiredstring—
rangeRequiredGanttRange—
snapshotRequiredGanttSnapshot—
classNamestring | undefined—
defaultScale"day" | "week" | undefined—
onSave((change: GanttChange, context: GanttSaveContext) => Promise<GanttSaveResult>) | undefined—
onSnapshotChange((snapshot: GanttSnapshot) => void) | undefined—
readOnlyboolean | undefined—
sourceKeystring | number | undefined—

GanttSnapshot

GanttSnapshot public properties
PropTypeDefault
dependenciesRequiredGanttDependency[]—
revisionRequirednumber—
tasksRequiredGanttTask[]—

GanttTask

GanttTask public properties
PropTypeDefault
endDayRequiredstring—
idRequiredstring—
progressRequirednumber—
revisionRequirednumber—
startDayRequiredstring—
titleRequiredstring—
milestoneboolean | undefined—

GanttDependency

GanttDependency public properties
PropTypeDefault
fromRequiredstring—
lagDaysRequirednumber—
toRequiredstring—

GanttChange

GanttChange public properties
PropTypeDefault
endDayRequiredstring—
expectedRevisionRequirednumber—
expectedSnapshotRevisionRequirednumber—
predecessorsRequiredGanttPredecessor[]—
progressRequirednumber—
startDayRequiredstring—
taskIdRequiredstring—

GanttSaveResult

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

GanttSaveResult 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.