4.4.3 • Published 28 days ago

vertical-timeline-component-react v4.4.3

Weekly downloads
81
License
MIT
Repository
github
Last release
28 days ago

Vertical Timeline Component React

Status

Coveralls Status CI npm version bundlephobia downloads GitHub license GitHub issues GitHub forks GitHub stars Package Quality PRs welcome CodeSandbox

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

This is the wrapper component that creates the vertical timeline.

  • Children
Number of childrenRequiredValue Allowed
ManyAt least the first Events component is requiredOnly Events components
  • Props
nameTypeRequiredValues Alloweddefault valuesDescription
themeobjectfalsecolors{ borderDotColor: '#ffffff', descriptionColor: '#cccccc', dotColor: '#c5c5c5', eventColor: '#cccccc', lineColor: '#c5c5c5', subtitleColor: '#c5c5c5', titleColor: '#cccccc', yearColor: '#888888' }Set colors in all components
langstringfalseen, es, de, tr or zhenChange the language from and to texts and change the format in the dates
dateFormatstringfalseonly-number, short, with-weekday or fullonly-numberChange the presentation format of dates
collapsebooleanfalsetrue or falsefalseAllow collapsing description of all Content components
withoutDaybooleanfalsetrue or falsefalseWill hide the day of the dates of all Content components

dateFormat: The next table shows the different formats that can be used in the dateFormat prop and the result that will be displayed.

only-numbershortwith-weekdayfull
English (en)MM/D/YYYYMMM DD, YYYYddd, MMM DD, YYYYdddd, MMMM DD, YYYY
Spanish (es)D/MM/YYYYDD MMM YYYYddd, DD [de] MMM YYYYdddd, DD [de] MMMM [de] YYYY
German (de)D.MM.YYYYDD.MMM.YYYYddd., DD. MMM. YYYYdddd, DD. MMMM YYYY
Turk (tr)DD.MM.YYYYDD MMM YYYYDD MMM YYYY dddDD MMMM YYYY dddd
Simplified Chinese (zh)YYYY/MM/DYYYY年MM月DD日YYYY年MMM月DD日YYYY年MM月DD日dddd

This component is the container of the content of each year. It is required to have at least one Events component as a child of the Timeline component. It can have as many Events components as you want.

  • Children
Number of childrenRequiredValue Allowed
ManyAt least the first Event component is requiredOnly Event components
  • Props
NameTypeRequiredValues Alloweddefault valuesDescription
titlestring, JSX.Elementtrueany string, or some componentdoes not applyThe title of this block time
startDatestringtrueYYYY/MM/DD - YYYY/MM - YYYYdoes not applyThe date of the start of the content or contents
endDatestringfalseYYYY/MM/DD - YYYY/MM - YYYYdoes not applyThe date of the end of the content or contents
activebooleanfalsetrue or falsefalseThe value is the current year, it is recommended to use it in the last Container
withoutDaybooleanfalsetrue or falsefalseWill hide the day of the dates for this component only
defaultClosedbooleanfalsetrue or falsefalseWill collapse the content of this component only

For each Events you need one or more Event component.

  • Props
NameTypeRequiredDescription
titlestringfalseIt's the title of one or many descriptions
descriptionarray of stringstrueYou can write anything you want, but remember that it is consistent with the title

If the title is not defined (or empty), the description will always be displayed even when the defaultClosed prop is in the Events component

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

Using class components:

import { Timeline, Events, Event } from 'vertical-timeline-component-react';

const customTheme = {
	borderDotColor: '#ffffff',
	descriptionColor: '#262626',
	dotColor: '#d0cdc4',
	eventColor: '#965500',
	lineColor: '#d0cdc4',
	subtitleColor: '#7c7c7c',
	titleColor: '#405b73',
	yearColor: '#405b73',
};

class Main extends Component {
	render() {
		return (
			<Timeline lang="en" theme={customTheme} dateFormat="only-number" collapse withoutDay>
				<Events
					title={<a href="#">What is lorem Ipsum?</a>}
					subtitle="It's a fake text"
					startDate="2020/12/02"
					defaultClosed
					active
				>
					<Event
						title="Lorem Ipsum"
						description={[
							"Is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard",
							'Is simply dummy text of the printing and typesetting industry.',
						]}
					/>
				</Events>
			</Timeline>
		);
	}
}

Using function components:

import { Timeline, Events, Event } from 'vertical-timeline-component-react';

const Main = () => {
	const customTheme = {
		borderDotColor: '#ffffff',
		descriptionColor: '#262626',
		dotColor: '#d0cdc4',
		eventColor: '#965500',
		lineColor: '#d0cdc4',
		subtitleColor: '#7c7c7c',
		titleColor: '#405b73',
		yearColor: '#405b73',
	};

	return (
		<Timeline lang="en" theme={customTheme} dateFormat="only-number" collapse withoutDay>
			<Events
				title="What is lorem Ipsum?"
				subtitle="It's a fake text"
				startDate="2020/12/02"
				active
				defaultClosed
			>
				<Event
					title="Lorem Ipsum"
					description={[
						"Is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard",
						'Is simply dummy text of the printing and typesetting industry.',
					]}
				/>
			</Events>
		</Timeline>
	);
};

Code and documentation copyright 2020–2022 the Vertical Timeline Component React Authors and Me. Code released under the MIT License.

4.4.3

28 days ago

4.4.1

1 year ago

4.4.0

1 year ago

4.3.2

1 year ago

4.3.4

1 year ago

4.3.3

1 year ago

4.3.0

1 year ago

4.0.4

2 years ago

4.1.0

2 years ago

4.2.1

2 years ago

4.0.3

2 years ago

4.2.0

2 years ago

4.1.1

2 years ago

4.0.2

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.1

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago