Background
Existing major swipe libraries offer extensive features but suffer from heavy bundle sizes, and frequently collide with native project styles during design customization.
In particular, there was a critical need for a lightweight swipe solution that could operate seamlessly even on low-end devices or in poor network environments.
To address this challenge, I designed a 'Headless' library where the core mechanics are fully managed while leaving the UI styling entirely to the consumer developer.
Problem Solved
- Eliminating Framework Dependency: Separated the core swipe mechanics into an uncontrolled, DOM-manipulation centric layer. This allows identical logic to execute consistently across any frontend framework, including React, Vue, and Svelte.
- Bundle Size Optimization: Achieved a significantly lighter footprint compared to alternative libraries by focusing strictly on essential swipe functionalities like Infinite Scroll and Carousels.
- Unconstrained UI Customization: Provided a programmatic Headless Hook approach that avoids enforcing specific markups or inline styles, empowering developers to maintain absolute control over the swipe UI to perfectly match their internal design systems.
Technical Decisions
- Headless Architecture: Selected to decouple the UI presentation from business logic, maximizing reusability and offering flexible adaptation to diverse design requirements.
- TypeScript: Adopted to provide library consumers with robust type definitions and static guardrails, eliminating runtime errors during complex gesture event handling and vastly improving the developer experience (DX).
- Multi-Package (Monorepo): Utilized a monorepo setup to efficiently manage framework-specific wrapper packages (React, Vue, Svelte) while serving them from a single, immutable source of core logic.
- Vanilla DOM API: Relying directly on raw DOM manipulation rather than heavy framework state lifecycles ensured optimal rendering performance and absolute framework independence.
README

Custom-Swipe: A Lightweight and Headless Frontend Library
Custom-Swipe is a versatile solution designed for seamless user interactions in web applications. Whether you're building a responsive web app or enhancing the user experience on various devices, Custom-Swipe offers a range of swipe features. It serves as both a basic component for easy integration and a powerful headless hook for developers seeking granular control.
Key Features
- Lightweight: Minimize your bundle size with our lightweight library.
- Responsive: Ensure smooth interactions across various devices and screen sizes.
- Customizable: Tailor swipe behavior to suit your application's specific needs.
- Headless Hook: For developers who prefer a programmatic approach, our headless hook provides extensive control over swipe events.
Explore the possibilities with Custom-Swipe and elevate your frontend development experience.
Supports
Features
- Swipe
- Infinite swipe(scroll)
- Carousel
LICENSE
- MIT