Socket
Socket
Sign inDemoInstall

@wethegit/react-marquee

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wethegit/react-marquee

- [Getting set up](#getting-set-up) - [Install](#install) - [Import the CSS](#import-the-css) - [Usage](#usage) - [Props](#props) - [Styling](#styling) - [Reduced motion](#reduced-motion)


Version published
Maintainers
0
Created
Source

@wethegit/react-marquee

  • Getting set up
  • Usage
  • Props
  • Styling
  • Reduced motion

Getting set up

Install

npm install @wethegit/react-marquee

Import the CSS

Import this wherever it makes sense to, based on your project structure:

import "@wethegit/react-marquee/style.css"

Usage

const YourComponent = () => {
  const prefersReducedMotion = window.matchMedia(
    "(prefers-reduced-motion: reduce)"
  ).matches

  return (
    <Marquee
      className="marquee--modifier-class"
      prefersReducedMotion={prefersReducedMotion}
      reducedMotionSpeed={20}
    >
      {/* Good practice to add size of image to avoid stutter */}
      <img src="image-1.png" alt="" width="500" height="500" />
      <img src="image-2.png" alt="" width="500" height="500" />
      <img src="image-3.png" alt="" width="500" height="500" />
    </Marquee>
  )
}

Props

PropTypeDefault valueDescription
speedNumber50Controls the speed of the marquee animation. If prefersReducedMotion is true, speed defaults to reducedMotionSpeed.
reducedMotionSpeedNumber20A customisable value used to set the speed of the component if prefersReducedMotion is true.
prefersReducedMotionBooleanfalseWhether the user prefers reduced motion. If true, the component will default to a much slower speed, unless a custom speed is specified using: reducedMotionSpeed.
playingBooleantrueWhether the marquee animation is playing or paused.
classNameStringOptional class added to the parent element.
childrenNodeThe child elements rendered within the component. In the example above these are images, however they can be any type of element.

Styling

This component uses the BEM methodology for CSS classNames — the block here being .marquee.

Reduced motion

Use the prefersReducedMotion prop to serve up a reduced motion experience for your users who have that option enabled on their systems. The boolean prefersReducedMotion prop can be derived via the browser's matchMedia API, if true the marquee defaults to a much slower speed, unless reducedMotionSpeed is passed. This workflow is demonstrated in the Usage section above.

Keywords

FAQs

Package last updated on 11 Sep 2024

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