npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@omnedia/ngx-timeline

v1.0.1

Published

A simple component library to add an animated timeline view.

Downloads

17

Readme

ngx-timeline

@omnedia/ngx-timeline is an Angular component that helps you create elegant and responsive timelines. It offers dynamic scrolling effects, customizable orientation, and flexible styling options to fit your needs. Whether you're showcasing a sequence of events, project milestones, or any chronological content, this component makes it simple and stylish.

Features

  • Dynamic Timelines: Automatically adjusts and animates based on the scroll position.
  • Flexible Orientation: Supports both left and right orientation for timelines.
  • Customizable Styling: Fine-tune gaps between entries, titles, and contents with CSS variables.
  • Responsive Design: Optimized for all screen sizes.

Installation

Install the library using npm:

npm install @omnedia/ngx-timeline

Usage

Import the NgxTimelineComponent in your Angular module or component:

import { NgxTimelineComponent } from '@omnedia/ngx-timeline';

@Component({
  ...
  imports: [
    ...
    NgxTimelineComponent,
  ],
  ...
})
export class YourComponent {}

Use the component in your template:

<om-timeline
  [orientation]="'left'"
  [data]="timelineEntries"
  [entriesGap]="'4rem'"
  [entryGap]="'2rem'"
  [titleGap]="'1.5rem'"
  styleClass="custom-timeline"
></om-timeline>

Data Structure

The data input expects an array of objects representing the timeline entries. Each entry should have a title and content property. Both values can be html code.

const timelineEntries: TimelineEntry[] = [
  {
    title: '<p>Start</p>',
    content: '<div>The beginning of the project.<div>',
  },
  {
    title: '<p>Development</p>',
    content: 'Key development milestones achieved.',
  },
  {
    title: '<p>Launch</p>',
    content: '<div>The project goes live!</div>',
  },
];

How It Works

  • Timeline Structure: The component organizes your content into a vertical timeline. Each entry is a combination of a title and content.
  • Scroll Animation: As the user scrolls, the timeline line animates, giving a visual indication of progress through the timeline.
  • Orientation: Display the timeline on either the left or right side of the content, depending on your design preference.

API

<om-timeline
  [orientation]="orientation"
  [data]="data"
  [entriesGap]="entriesGap"
  [entryGap]="entryGap"
  [titleGap]="titleGap"
  [titleMaxWidth]="titleMaxWidth"
  [pathWidth]="pathWidth"
  [pathColor]="pathColor"
  [gradientColors]="gradientColors"
  styleClass="your-custom-class"
></om-timeline>
  • data (required): An array of timeline entries. Each entry must include a title and content.
  • orientation (optional): Defines the alignment of the timeline entries. Accepts 'left', 'right', or 'switch'. Default is 'left'.
  • entriesGap (optional): Defines the gap between timeline entries. Accepts any valid CSS size value. Default is '5rem'.
  • entryGap (optional): Defines the gap between the title and content within an entry. Accepts any valid CSS size value. Default is '4rem'.
  • titleGap (optional): Defines the gap between the circle and the title within an entry. Accepts any valid CSS size value. Default is '2rem'.
  • titleMaxWidth (optional): Defines the max width of the title elements. Default is '25rem'.
  • pathWidth (optional): Defines the width of the timeline path. Accepts any valid CSS size value. Default is '2px'.
  • pathColor (optional): Defines the colors of the timeline path. Accepts an array of two CSS color values for the path. Default is '#e2e8f0'.
  • gradientColors (optional): Defines the colors for the gradient on the path. Accepts an array of two CSS color values. Default is ['#3b82f6', '#7f00ff'].
  • styleClass (optional): Custom CSS class to apply to the component.

Example

<om-timeline
  [orientation]="'right'"
  [data]="[
    { title: 'Step 1', content: 'Initial planning phase.' },
    { title: 'Step 2', content: 'Development in progress.' },
    { title: 'Step 3', content: 'Final review and launch.' }
  ]"
  styleClass="example-timeline"
></om-timeline>

This example shows a right-aligned timeline with custom data.

Styling

const timelineEntries: TimelineEntry[] = [
  {
    title: '<p class="timeline-title">Start</p>',
    content: '<div class="timeline-content">The beginning of the project.<div>',
  },
    ...
];
<om-timeline styleClass="custom-timeline" [data]="timelineEntries"></om-timeline>
/* Component Styling */
.timeline-title, .timeline-content {
    font-size: 2rem;
    color: white;
}

.timeline-title {
    font-weight: blod;
}

/* Global Styling */
.custom-timeline .om-timeline-entry-header .om-timeline-circle {
  background-color: #4caf50;
}

This CSS customizes the color of the timeline circles and sets some text styling for the title and content.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License.