Gantt chart react component
Please ★ this repo if you found it useful ★ ★ ★
Submit your ReactGantt use cases and I will feature them in the in the used by section
Vite Next generation frontend tooling
- Multiple steps
- Custom styles
- Dynamic bounds
- zoom
- drag
- typescript support
See a demo
npm i web-react-gantt --save
# or yarn add web-react-gantt --save
import React, { useState } from "react";
import {
Timeline,
Activebar,
getTimeline,
UnitType,
ConfigContext,
} from "web-react-gantt";
function App() {
const [scale, setCount] = useState(30);
const data = getTimeline(36);
const unit = 15;
const type = "hour";
const pice = UnitType[type] / unit;
const width = data.length * scale * pice;
return (
<div className="App">
<div className="flex">
<div className="left">
<button onClick={() => setCount(scale + 5)}>+</button>
<button onClick={() => setCount(scale - 5)}>-</button>
</div>
<div className="right">
<ConfigContext.Provider value={{ unit, type, scale, width }}>
<Timeline data={data} />
<Activebar name={"活动中"} start={9} end={16} />
<Activebar name={"活动2"} start={3} end={8} />
</ConfigContext.Provider>
</div>
</div>
</div>
);
}
export default App;
git clone [email protected]:bjtqti/gantt.git
cd web-react-gannt
npm install
npm start
- after installed then vistor http://localhost:3000
Timeline
Activebar
| Prop Name | Type
width: number; unit: number; scale: number; type: TimelineType; data: TimelineDataProps[]; scale?: number; type?: TimelineType; unit?: number;
| Prop Name | Type
start: number; end: number; name?: string;
Review the guidelines for contributing
ouyangli © 2022
Review the changelog
- ouyangli - Author