[Timeline] Add support for `align` override on items
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Summary 💡
<Timeline />
component supports 3 different alignments: align: 'alternate' | 'left' | 'right'
. While this is enough for most cases, I believe it could be useful to add support for override in each <TimelineItem />
with a align: 'left' | 'right'
property or something similar.
Examples 🌈
import * as React from 'react';
import Timeline from '@material-ui/lab/Timeline';
import TimelineItem from '@material-ui/lab/TimelineItem';
import TimelineSeparator from '@material-ui/lab/TimelineSeparator';
import TimelineConnector from '@material-ui/lab/TimelineConnector';
import TimelineContent from '@material-ui/lab/TimelineContent';
import TimelineDot from '@material-ui/lab/TimelineDot';
export default function AlternateTimeline() {
return (
<Timeline align='alternate'>
<TimelineItem align="right">
<TimelineSeparator>
<TimelineDot />
<TimelineConnector />
</TimelineSeparator>
<TimelineContent>Eat</TimelineContent>
</TimelineItem>
<TimelineItem>
<TimelineSeparator>
<TimelineDot />
<TimelineConnector />
</TimelineSeparator>
<TimelineContent>Code</TimelineContent>
</TimelineItem>
<TimelineItem>
<TimelineSeparator>
<TimelineDot />
<TimelineConnector />
</TimelineSeparator>
<TimelineContent>Sleep</TimelineContent>
</TimelineItem>
<TimelineItem align='right'>
<TimelineSeparator>
<TimelineDot />
</TimelineSeparator>
<TimelineContent>Repeat</TimelineContent>
</TimelineItem>
</Timeline>
);
}
Motivation 🔦
It will allow to build an alternating timeline with grouped TimelineItem(s):
I believe that the keyword is “groups”. When you build a long <Timeline />
with multiple <TimelineItem />
(s) rich of contents, align='alternate'
helps to reduce void space in the page, but could also lead to a disorienting UI because similar components are placed in opposite positions. The best way to solve this problem is to group similar items.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (6 by maintainers)
Top Results From Across the Web
align-items - CSS: Cascading Style Sheets - MDN Web Docs
Used alongside an alignment keyword. If the chosen keyword means that the item overflows the alignment container causing data loss, the item is ......
Read more >Supports | Block Editor Handbook
When the block declares support for align , the attributes definition is extended ... To disable this behavior for a single block, set...
Read more >Snap to items in the Final Cut Pro timeline - Apple Support
In Final Cut Pro, turn on snapping to make it easier to align items in the timeline with key points such as clip...
Read more >Working in the Timeline Display – Universal Audio Support ...
Using Align Bar and Align Grid to derive tempo from audio tracks ... Rulers allow you to track timeline data and add markers, ......
Read more >Timeline - Widgets - Ultimate Addons for Elementor
Content Timeline · Add date within each item · Responsive support for alignment · Override style of a single item · Option to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@simonecervini Oh yeah, I got trapped by this as well working on the previous POC! How about?
cc @mnajdova
I think it’s a lot more clear. I’ve created a pull request as a proof of concept with all these changes