Gantt example

Keep civil dates stable in either reading direction.

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

Complete React client module · MIT · Next.js and Vite

Interactive example

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>;}