Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-event-timeline

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-event-timeline

A responsive event timeline in React.js

  • 1.6.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1K
decreased by-7.22%
Maintainers
1
Weekly downloads
 
Created
Source

react-event-timeline

React component to generate a responsive event timeline.

npm version Build Status codecov license

alt tag

See the storybook demo here: https://rcdexta.github.io/react-event-timeline

CodeSandbox version to play with (in typescript):

Edit Timeline Example

Note: CodeSandbox version has styling and icons loaded in index.html for better presentation!

Features

  • It's lightweight
  • Responsive and extensible

Getting started

To install the dependency

npm install --save react-event-timeline

or if you use yarn

yarn add react-event-timeline

Usage

The following snippet generates the timeline you see in the screenshot:

import {Timeline, TimelineEvent} from 'react-event-timeline'

ReactDOM.render(
    <Timeline>
            <TimelineEvent title="John Doe sent a SMS"
                           createdAt="2016-09-12 10:06 PM"
                           icon={<i className="material-icons md-18">textsms</i>}
            >
                I received the payment for $543. Should be shipping the item within a couple of hours.
            </TimelineEvent>
            <TimelineEvent
                title="You sent an email to John Doe"
                createdAt="2016-09-11 09:06 AM"
                icon={<i className="material-icons md-18">email</i>}
            >
                Like we talked, you said that you would share the shipment details? This is an urgent order and so I
                    am losing patience. Can you expedite the process and pls do share the details asap. Consider this a
                    gentle reminder if you are on track already!
            </TimelineEvent>
    </Timeline>,
      document.getElementById('container')
);

Please refer storybook to check out code for all the examples in the storybook folder.

API Documentation

Timeline

This is the wrapper component that creates the infinite vertical timeline

NameTypeDescription
classNamestringThe css class name of timeline container
styleobjectOverride inline styles of timeline container
orientationstringDisplay the timeline on right or left. Default: left
lineColorstringCSS color code to override the line color
lineStylestringOverride the appearance of line with custom css styling

TimelineEvent

Each event in the timeline will be represented by the TimelineEvent component. There can be multiple repeating instances of this component inside Timeline wrapper

NameTypeDescription
titlenodeThe title of the event. Can be string or any DOM element node(s)
createdAtnodeThe time at which the event occurred. Can be datetime string or any DOM element node(s)
subtitlenodeIf you prefer having the title at the top and some caption below, omit createdAt and specify title and subtitle
iconnodeThe icon to show as event lable. Can be a SVG or font icon
iconStyleobjectCustom CSS styling for the icon
bubbleStyleobjectCustom CSS styling for the bubble containing the icon
buttonsnodeAction buttons to display to the right of the event content
contentStylenodeOverride content style
containerstringOptional value card will render event as a Card
styleobjectOverride style for the entire event container. Can be used to modify card appearance if container is selected as card
titleStyleobjectOverride style for the title content
subtitleStyleobjectOverride style for the subtitle content
cardHeaderStyleobjectOverride style for the card header if container is card
collapsiblebooleanMake the timeline event collapse body content
showContentbooleanif collapsible is true, should content be shown by default. false is default value

TimelineBlip

Use this component if your event footprint is too small and can be described in a single line

NameTypeDescription
titlenodeThe title of the event. Can be string or any DOM element node(s)
iconnodeThe icon to show as event label. Can be a SVG or font icon
iconColorstringCSS color code for icon
iconStyleobjectCustom CSS styling for the icon
styleobjectOverride style for the entire event container

Refer to Condensed Timeline in Storybook for examples of using this component

Development

This project recommends using react-storybook as a UI component development environment. Use the following scripts for your development workflow:

  1. npm run storybook: Start developing by using storybook
  2. npm run lint : Lint all js files
  3. npm run lintfix : fix linting errors of all js files
  4. npm run build: transpile all ES6 component files into ES5(commonjs) and put it in dist directory
  5. npm run docs: create static build of storybook in docs directory that can be used for github pages

The storybook artefacts can be found in stories folder. Run npm run storybook and you should see your code changes hot reloaded on the browser

Also use semantic-release to automate release to npm. Use npm run commit to commit your changes and raise a PR.

License

MIT

Keywords

FAQs

Package last updated on 12 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc