animated-paginator-web-component
v1.0.3
Published
A reusable animated paginator implemented as a Web Component.
Maintainers
Readme
Animated Paginator Web Component
A lightweight, framework-agnostic paginator built as a native Web Component.
✨ Features
• Smooth pill-style animation between pages
• Fully encapsulated styles (Shadow DOM)
• Zero dependencies – works everywhere modern ES modules are supported
• Customisable via attributes & public API methods
• Emits page-changed events so your app can react to user navigation
📦 Installation
npm install animated-paginator-web-component
# or
yarn add animated-paginator-web-component🚀 Usage
Simply import the package once (ES module) and drop the element into your HTML. No framework required:
<!-- main.js -->
import 'animated-paginator-web-component';<!-- index.html -->
<animated-paginator
pages="5"
initial-page="0"
page-colors="#4285F4,#FDBB2D,#9A40D3,#34A853,#EA4335">
</animated-paginator>Reacting to page changes
const paginator = document.querySelector('animated-paginator');
paginator.addEventListener('page-changed', ({ detail }) => {
console.log(`Moved from ${detail.oldPage} → ${detail.newPage}`);
});Programmatic navigation
paginator.next(); // advance one page
paginator.previous(); // go back one
console.log(paginator.getCurrentPage());🛠️ Local Development
- Clone & install:
git clone https://github.com/yourgithub/animated-paginator-web-component && cd animated-paginator-web-component && npm i - Link the package (optional):
npm linkand in a demo projectnpm link animated-paginator-web-component - Open
demo/index.htmlin your browser to see it in action.
📝 License
MIT © Elad Ben-Haim
