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

@guna81/react-ticker

v3.4.1

Published

A simple and customizable react ticker (news scroller) component.

Downloads

511

Readme

React Ticker

A simple and customizable react ticker (news scroller) component.

Installation

Install with npm

  npm install @guna81/react-ticker

Demo

Checkout the Demo.

Usage/Examples

export default function App() {
  const data = [
    {
      id: 1,
      value:
        "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
    },
    // more data ...
  ];

  const renderItem = (item) => {
    return (
      <p style={{ whiteSpace: "nowrap", color: "orange" }} >
        {item.value}
      </p>
    );
  };

  return (
    <div className="App">

      {/* using default ticker item component */}
      <ReactTicker
        data={data.map((item) => item.value)}
        speed={20}
        keyName="_id"
        tickerStyle={{
          position: "fixed",
          top: 0,
          left: "0",
          width: "100%",
          height: "40px",
          backgroundColor: "#fff",
          zIndex: 99,
          borderTop: "1px solid #e0e0e0"
        }}
        tickerClassName="news-ticker"
      />
      
      {/* using custom ticker item component */}
      <ReactTicker
        data={data}
        component={renderItem}
        speed={40}
        keyName="_id"
        tickerStyle={{
          position: "fixed",
          bottom: 0,
          left: "0",
          width: "100%",
          height: "40px",
          backgroundColor: "#fff",
          zIndex: 99,
          borderTop: "1px solid #e0e0e0"
        }}
        tickerClassName="news-ticker"
      />
    </div>
  );
}

API Reference

Props

| Parameter | Type | Description | Default Value | | :-------- | :------- | :---------------------- | :------------------ | | data | array | Required. List of objects or strings. | empty array | | component | react node | Custom ticker item component. | null | | keyName | string | Key of object (Required, if only the data is a list of objects.). | null | | speed | number | Scroll speed (0 - 60). | 30 | | delay | number | Scroll delay. | 0 | | diretion | string | Scroll direction. | normal | | tickerClassName | string | Ticker container class name. | empty string | | itemClassName | string | Ticker item class name. | empty string | | tickerTextClassName | string | Ticker text class name (Required, if only the data is a list of strings). | empty string | | tickerStyle | object | Ticker container style. | empty object | | itemStyle | object | Ticker item styles. | empty object | | loop | boolean | Infinite scroll. | true |

  • Component and keyName props are required if data is a list of objects.
  • If data is a list of strings, components, and keyName props are unnecessary.