1.1.2 • Published 2 years ago

react-tailwind-timeline-component v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Tailwind Timeline Component

Version Bundle Size Total Downloads License Type Used by Buy Coffee


Render a timeline with React and Tailwind CSS in your React project.

React Tailwind Timeline Component is a highly customizable timeline component that works perfect with Tailwind CSS.

⚠️ DISCLAIMER

Using this package does not mean you are using Tailwind CSS nor any icon package. You should import your own icon package and install Tailwind CSS yourself.

Try it yourself!

Demo GIF

Install

npm install react-tailwind-timeline-component

Usage

With Timeline

Use Timeline component to render a sorted timeline. Notice that you should pass a date property to the timeline events and those that do have this property, will be sorted.

// App.js
import { Timeline, EventTimeline } from "react-tailwind-timeline-component";

// Disclaimer: This icon package is used as example only.
import { FaTasks } from "react-icons/fa";

export default function App() {
    return (
        <Timeline>
            <EventTimeline
                title="Title 1"
                description="Some description..."
                icon={<FaTasks />}
                date={new Date(2022, 5, 15)}
            />
            <EventTimeline
                title="Title 2"
                description="Some description..."
                icon={<FaTasks />}
                date={new Date(2022, 5, 1)}
            />
            <EventTimeline
                title="Title 3"
                description="Some description..."
                icon={<FaTasks />}
                date={new Date(2022, 5, 30)}
            />
        </Timeline>
    );
}

Without Timeline

If you do not require a sorted timeline, you can use the <EventTimeline> component without the <Timeline> component.

// App.js
import { Timeline, EventTimeline } from "react-tailwind-timeline-component";

// Disclaimer: This icon package is used as example only.
import { FaTasks } from "react-icons/fa";

export default function App() {
    return (
        <EventTimeline
            title="Title 1"
            description="Some description..."
            icon={<FaTasks />}
        />
        <EventTimeline
            title="Title 2"
            description="Some description..."
            icon={<FaTasks />}
        />
        <EventTimeline
            title="Title 3"
            description="Some description..."
            icon={<FaTasks />}
        />
    );
}

Types

Timeline

PropertyDescriptionRequiredTypeDefault Value
childrenTimeline events✔️ReactNode-
classNameClass name of the timelinestring-
sortWhether to sort timeline eventsbooleantrue
ascendingWhether to sort timeline events in ascending orderbooleantrue
beforeUndatedContentWhether to display the sorted events before any other content that does not have a date propertybooleantrue

EventTimeline

PropertyDescriptionRequiredTypeDefault Value
titleTitle of the timeline event✔️string-
descriptionDescription of the timeline event✔️string-
iconIcon of the timeline event✔️ReactNode-
dateDate of the timeline eventDate-
classNameClass name of the timeline eventstring-
showLineWhether to show a line between the timeline event and the previous onebooleantrue
showIconWhether to show the icon of the timeline eventbooleantrue
leftSideContentContent to be displayed on the left side of the timeline eventstring \|\| ReactNode-
leftSideContentClassNameClass name of the left side contentstring-
rightSideContentContent to be displayed on the right side of the timeline eventstring \|\| ReactNode-
rightSideContentClassNameClass name of the right side contentstring-
titleClassNameClass name of the title of the timeline eventstring-
lineClassNameClass name of the line between the timeline event and the previous onestring-
iconBackgroundClassNameClass name of the background of the icon of the timeline eventstring-
cardClassNameClass name of the card (details) of the timeline eventstring-
darkModeWhether to use dark modebooleanfalse
onIconClickCallback to be executed when the icon of the timeline event is clickedfunction-
onTitleClickCallback to be executed when the title of the timeline event is clickedfunction-
onCardClickCallback to be executed when the card of the timeline event is clickedfunction-
onLeftSideContentClickCallback to be executed when the left side content of the timeline event is clickedfunction-
onRightSideContentClickCallback to be executed when the right side content of the timeline event is clickedfunction-

License

The React Tailwind Timeline Component is licensed under MIT.

Motivation

Due to the fact that there are a few timeline components out there, I decided to create my own. I wanted to create a timeline component that works perfectly with Tailwind CSS. I also wanted to create a timeline component that is highly customizable and easy to use.

Links

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago