Git Product home page Git Product logo

vertical-timeline-component-react's Introduction

vertical-timeline-component-react

A simple component to generate a responsive vertical timeline Vertical Timeline Component React

Status

Coverage Status Version Build Status Dependencies devDependencies Status peerDependencies Status

Getting started

To install as npm dependency

npm install --save vertical-timeline-component-react

Or if you preferred, you can use yarn

yarn add vertical-timeline-component-react

API Documentation

Timeline

This is the wrapper component that creates the vertical timeline.

Content

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

ContentYear

For each Content you need ContentYear since with this component you mark the events in the given year.

Name Type Required Values Allowed Description
startMonth string or number false from 0 to 12 The month of the start of the content or contents
monthType string false text or number (default) Type of how to show the month
startDay string false from 1 to 31 The day of the start of the content or contents
startYear string true any year The year of the start of the content or contents
currentYear boolean false false (default) When the content is still being made

ContentBody

For each Content you need ContentBody, because with this component you describe the events that occurred in that year using Description component.

Name Type Required Description
Title String True Show the title for the events
Children Node True It is necessary to use the description component.

Description

With this component you describe the events one for one.

Name Type Required Description
Text String True Describe the event
Optional String False You can this props for use a optional text

How to use it

The following snippet will show you how to use the library:

Using class components:

import {
  Timeline,
  Content,
  ContentYear,
  ContentBody,
  Description
} from 'vertical-timeline-component-react';

class Main extends Component {
  render() {
    return (
      <Timeline>
        <Content>
          <ContentYear
            startMonth="12"
            monthType="text"
            startDay="24"
            startYear="2016"
            currentYear
          />
          <ContentBody title="Amazing Title">
            <Description
              text="I'm an amazing event"
              optional="I'm an amazing optional text"
            />
            <Description
              text="I'm an amazing event"
              optional="I'm another amazing optional text"
            />
            <Description text="I'm an amazing event" />
          </ContentBody>
        </Content>
        <Content>...</Content>
      </Timeline>
    );
  }
}

Using function components:

import {
  Timeline,
  Content,
  ContentYear,
  ContentBody,
  Description
} from 'vertical-timeline-component-react';

const Main = () => (
  <Timeline>
    <Content>
      <ContentYear
        startMonth="12"
        monthType="text"
        startDay="24"
        startYear="2016"
        currentYear
      />
      <ContentBody title="Amazing Title">
        <Description
          text="I'm an amazing event"
          optional="I'm an amazing optional text"
        />
        <Description
          text="I'm an amazing event"
          optional="I'm another amazing optional text"
        />
        <Description text="I'm an amazing event" />
      </ContentBody>
    </Content>
    <Content>...</Content>
  </Timeline>
);

License

MIT

vertical-timeline-component-react's People

Contributors

proskynete avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.