Skip to content

Commit d9ea3bf

Browse files
committed
add example on stackItems
1 parent 79ce954 commit d9ea3bf

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,51 @@ and this project adheres (more or less) to [Semantic Versioning](http://semver.o
1414
- fix bug where `canMove` prop gets ignored #484 - @acemac + @ilaiwi
1515
- fix sidebar re-render when groupHeights do not change #478 - @SDupZ
1616

17+
### Stack per group
18+
19+
now you can stack choose to stack items in individual groups by providing the property `stackItems` in group object. The property in group overrides the timeline prop `stackItems`.
20+
21+
```
22+
const groups = [{ id: 1, title: 'group 1', stackItems: false }, { id: 2, title: 'group 2', stackItems: true }]
23+
24+
const items = [
25+
{
26+
id: 1,
27+
group: 1,
28+
title: 'item 1',
29+
start_time: moment(),
30+
end_time: moment().add(1, 'hour')
31+
},
32+
{
33+
id: 2,
34+
group: 2,
35+
title: 'item 2',
36+
start_time: moment().add(-0.5, 'hour'),
37+
end_time: moment().add(0.5, 'hour')
38+
},
39+
{
40+
id: 3,
41+
group: 1,
42+
title: 'item 3',
43+
start_time: moment().add(2, 'hour'),
44+
end_time: moment().add(3, 'hour')
45+
}
46+
]
47+
48+
ReactDOM.render(
49+
<div>
50+
Rendered by react!
51+
<Timeline
52+
groups={groups}
53+
items={items}
54+
defaultTimeStart={moment().add(-12, 'hour')}
55+
defaultTimeEnd={moment().add(12, 'hour')}
56+
/>
57+
</div>,
58+
document.getElementById('root')
59+
)
60+
```
61+
1762

1863
## 0.22.0
1964

0 commit comments

Comments
 (0)