mui / mui/material-ui

[lab][Timeline] Add directional `TimelineConnector`

Open
#39,596 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

package: lab scope: timeline type: new feature waiting for 👍
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Summary 💡

Ideally, the current TimeoutConnector could be made to be directional using props.

This could be via a direction prop, for example: "up" | "down".

It might also make sense to be able to set a direction on the Timeline parent; connectors could then default to whatever the Timeline prop specifies.

Examples 🌈
image
import * as React from 'react';
import Timeline from '@mui/lab/Timeline';
import TimelineItem from '@mui/lab/TimelineItem';
import TimelineSeparator from '@mui/lab/TimelineSeparator';
import TimelineConnector from '@mui/lab/TimelineConnector';
import TimelineContent from '@mui/lab/TimelineContent';
import TimelineDot from '@mui/lab/TimelineDot';

export default function BasicTimeline() {
  return (
    <Timeline direction="down">. {/**.set `direction` on the whole timeline */}
      <TimelineItem>
        <TimelineSeparator>
          <TimelineDot />
          <TimelineConnector />
        </TimelineSeparator>
        <TimelineContent>Eat</TimelineContent>
      </TimelineItem>
      <TimelineItem>
        <TimelineSeparator>
          <TimelineDot />
          <TimelineConnector direction="up" />  {/**.set `direction` on a specific connector */}
        </TimelineSeparator>
        <TimelineContent>Code</TimelineContent>
      </TimelineItem>
      <TimelineItem>
        <TimelineSeparator>
          <TimelineDot />
        </TimelineSeparator>
        <TimelineContent>Sleep</TimelineContent>
      </TimelineItem>
    </Timeline>
  );
}
Motivation 🔦

The current connector does not indicate the direction. Perhaps it can be achieved with some CSS trickery on the Mui classes, but that is unergonomic at best.

I can think of lots of cases where I'd like to use the Timeline and TimelineConnector to illustrate the history of some resource/process/etc, and having directional connectors makes it much easier to see the direction at a glance.

Without directional connectors, we tend to have to use dates–which require much more effort to grok quickly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing Timeline and TimelineConnector components, including the current connector behavior described as TimeoutConnector. Determine how a connector-level direction and an optional Timeline-level default should interact. Done means directional connectors visibly communicate up or down, while individual connector settings can override the parent setting.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.