Zero dependencies
No animation library, no framework peer, no transitive packages. Import only the API your project needs.
Accessible ticker tapes for the open web.
Announcements, logos, and prices. Just your content, in motion.
npm install @samline/ticker Zero dependencies TypeScript ready MIT licensed
Ticker manages motion. Your integration should provide a pause control and keep the original content readable.
ONE SMALL SCRIPT. RIGHT AT HOME IN YOUR STACK.
No animation library, no framework peer, no transitive packages. Import only the API your project needs.
Visual clones stay out of the accessibility tree and keyboard order. Honors prefers-reduced-motion automatically.
Remeasures on resize. Call refresh() after changing content. Pauses when the ticker leaves the viewport or the document is hidden.
Package imports or an HTML script tag, with the same controller API. Optional registry, page manager and core helpers fit different ownership needs.
Works in React, Vue, Svelte, Astro, plain HTML, WordPress, or Shopify. No adapter, no wrapper, no peer dependency.
Pass a selector or DOM element. Your source is restored on destroy(); the controller manages animation markup.
Start with the package import or an HTML script tag. The optional registry is available in either setup; CDN describes file delivery, not a different Ticker API.
Main
Package / ESM entry: import ticker() and load style.css. Also exports types, defaults and the optional registry.
Vanilla
Element-scoped controller plus the declarative page manager. Auto-discovers tickers as the DOM changes.
Registry
Optional ID-based registry for module imports. This browser subpath does not install window.Ticker and is not the CDN script.
HTML / CDN
Load the script from a CDN or your own server, plus style.css. It exposes window.Ticker for plain HTML, WordPress or Shopify.
Core
Types, defaults, state factories, and validation helpers for advanced integrations and custom builds.
Style
Required layout, animation, and reduced-motion styles. One import, no CSS framework required.
Installed with npm, pnpm or bun? Choose Package / ESM to import Ticker. Loaded the CDN files? Choose HTML / CDN to call window.Ticker. Both return the same controller.
Understand the loading optionsInstall
npm install @samline/ticker pnpm add @samline/ticker bun add @samline/ticker <link rel="stylesheet" href="https://unpkg.com/@samline/ticker@2.1.0/dist/style.css">
<script src="https://unpkg.com/@samline/ticker@2.1.0/dist/browser/global.global.js"></script> Add markup
Write the content as you normally would. The library enhances it, never replaces it.
<div id="news">
<a href="/one">First story</a>
<a href="/two">Second story</a>
<a href="/three">Third story</a>
</div> Initialize
import { ticker } from '@samline/ticker'
import '@samline/ticker/style.css'
const news = ticker('#news', {
duration: 20,
pauseOnHover: true,
}) const news = window.Ticker.ticker('#news', {
duration: 20,
pauseOnHover: true,
}) This is the minimal setup. Explore duration, direction and hover behavior before adapting the ticker to your design.
Explore configuration optionsChanging settings, editing content and removing a registered ticker need different actions. Start with the instance from Get started, then use the recipe that fits.
Use update() on the existing instance. Omitted settings keep their current values, so changing direction leaves the configured duration intact. The library schedules the refresh for you.
news?.update({
direction: 'right',
}) Add content to source, rather than the generated copies. Explicitly refresh after the edit: a resize check can reuse copies if the measured width stays unchanged.
const item = document.createElement('span')
item.textContent = 'Shipping something new.'
news?.source.append(item)
news?.refresh() If you created the ticker with window.Ticker.newTicker() in HTML / CDN, clean it up through destroyTicker(id). This removes the registry entry as well as the instance. Calling only the returned controller’s destroy() leaves registry bookkeeping behind.
window.Ticker.destroyTicker('news') window pollution beyond the Ticker namespace. aria-hidden="true" and removed from the tab order, so screen readers and keyboard users only see your original content. The library also pauses animation when the document is hidden and when the user's system reports a preference for reduced motion. <marquee> element deprecated? <marquee> as obsolete. This library gives you the behavior people still want from a marquee, on top of a normal <div> you fully control. ticker() factory and call destroy() from your unmount handler. There is no framework adapter to install and no peer dependency to ship. One small library. A whole new way to bring your content to life.
Prefer the full guide? Find setup instructions, API contracts and lifecycle examples in the documentation.
Read the documentation